Yii2 Essentials
Yii2 Essentials
- Manage Cache
- Manage Events
- Manage Menù
- Manage Rest API
- Manage Settings
- System Information
- System Requirements
Installation
The preferred way to install this extension is through composer.
Either run
$ php composer.phar require cinghie/yii2-essentials "*"
or add
"cinghie/yii2-essentials": "*"
Configuration
1. Update yii2 settings database schema
Make sure that you have properly configured db
application component
and run the following command:
$ php yii migrate/up --migrationPath=@vendor/pheme/yii2-settings/migrations
2. Update yii2 essentials database schema
Make sure that you have properly configured db
application component
and run the following command:
$ php yii migrate/up --migrationPath=@vendor/cinghie/yii2-essentials/migrations
3. Set configuration file
Set on your configuration file
'components' => [
'settings' => [
'class' => 'pheme\settings\components\Settings'
],
]
'modules' => [
// Yii2 Essentials
'essentials' => [
'class' => 'cinghie\essentials\Essentials',
'eventsRoles' => ['admin'],
'menuRoles' => ['admin'],
'messagesRoles' => ['admin'],
'restapiRoles' => ['admin'],
'settingsRoles' => ['admin'],
'restapiDebug' => false,
],
]
4. Set cache folder on frontend if on Yii2 app advanced
Set on your backend configuration file, in components section
'components' => [
// Cache
'cache' => [
'class' => 'yii\caching\FileCache',
'cachePath' => '@runtime/cache'
],
'frontendCache' => [
'class' => 'yii\caching\FileCache',
'cachePath' => '@frontend/runtime/cache'
],
]
Widgets
REST API
To let the API accept input data in JSON format, configure the parsers property of the request application component to use the yii\web\JsonParser for JSON input:
'components' => [
'request' => [
'parsers' => [
'application/json' => 'yii\web\JsonParser',
]
]
]
Then, modify the configuration about the urlManager component in your application configuration:
'components' => [
'urlManager' => [
'enablePrettyUrl' => true,
'enableStrictParsing' => true,
'showScriptName' => false,
'rules' => [
['class' => 'yii\rest\UrlRule', 'controller' => 'user'],
],
]
]
To generate a Rest API set in params sql and if required fields from the request
[ {
"sql":"SELECT id,username,email,created_at,blocked_at FROM {{%user}} ",
"fields":"id,username"
} ]
sql: the query to execute fields: fields from the request required in where query
LINKS
- Admin Panel: PathToApp/index.php?r=essentials
- Admin Panel with Pretty Urls: PathToApp/essentials
- Cache Manager: PathToApp/index.php?r=essentials/settings/cache
- Cache Manager with Pretty Urls: PathToApp/essentials/settings/cache
- Event Categories: PathToApp/index.php?r=essentials/eventcategories/index
- Event Categories with Pretty Urls: PathToApp/essentials/eventcategories/index
- Event Items: PathToApp/index.php?r=essentials/eventitems/index
- Event Items with Pretty Urls: PathToApp/essentials/eventitems/index
- Menù Types: PathToApp/index.php?r=essentials/menutypes/index
- Menù Types with Pretty Urls: PathToApp/essentials/menutypes/index
- Menù Items: PathToApp/index.php?r=essentials/menuitems/index
- Menù Items with Pretty Urls: PathToApp/essentials/menuitems/index
- Rest API: PathToApp/index.php?r=essentials/restapi/index
- Rest API with Pretty Urls: PathToApp/essentials/restapi/index
- Settings: PathToApp/index.php?r=essentials/settings/index
- Settings with Pretty Urls: PathToApp/essentials/settings/index
- System: PathToApp/index.php?r=essentials/settings/system
- System with Pretty Urls: PathToApp/essentials/settings/system
CHANGELOG
- Version 0.5.4 - Adding type and access, implementing login and logout on RestAPI
- Version 0.5.3 - Addiing active/deactive button on RestAPI, Events, Settings
- Version 0.5.2 - Updating RestAPI
- Version 0.5.1 - Updating Events
- Version 0.5.0 - Adding Events
- Version 0.4.1 - Updating REST API
- Version 0.4.0 - Adding REST API
- Version 0.3.2 - Improving module
- Version 0.3.1 - Updating Menu Widget
- Version 0.3.0 - Adding System Utilities
- Version 0.2.0 - Adding Menù
- Version 0.1.0 - Adding Settings
- Version 0.0.1 - Initial Releases
LIBRARIES NEEDED
- Yii2 Grid: https://github.com/kartik-v/yii2-grid
- Yii2 Settings: https://github.com/phemellc/yii2-settings
- Yii2 Social: https://github.com/kartik-v/yii2-social
- Yii2 Widgets: https://github.com/kartik-v/yii2-widgets