yii2-bridge / core
Simple admin panel for enthusiasts
Installs: 1 910
Dependents: 2
Suggesters: 0
Security: 0
Stars: 6
Watchers: 2
Forks: 2
Open Issues: 8
Type:project
Requires
- 2amigos/yii2-ckeditor-widget: ^2.1
- 2amigos/yii2-grid-view-library: ^1.0
- 2amigos/yii2-usuario: ~1.0
- codemix/yii2-localeurls: ^1.7
- kartik-v/yii2-widgets: ^3.4
- kolyunya/yii2-map-input-widget: ^1.2
- mihaildev/yii2-elfinder: ^1.2
- mohorev/yii2-upload-behavior: ^0.2.0
- phpdocumentor/reflection-docblock: ^4.1.1
- vlucas/phpdotenv: ^2.4
- yii2-bridge/slug-behavior: ^0.1
- yii2tech/admin: ^1.0
- yii2tech/ar-position: ^1.0
- yii2tech/ar-softdelete: ^1.0
- yiisoft/yii2: ^2.0
- yiisoft/yii2-bootstrap: ^2.0
- yiisoft/yii2-imagine: ^2.1
- zelenin/yii2-i18n-module: ^0.1.9
Requires (Dev)
- phpunit/phpunit: ^5.7
- yiisoft/yii2-gii: ^2.0
- dev-master
- v0.3.2
- v0.3.1
- v0.3.0
- v0.2.5
- v0.2.4
- v0.2.3
- v0.2.2
- v0.2.1
- v0.2.0
- v0.1.2
- v0.1.1
- v0.1.0
- dev-dependabot/npm_and_yarn/qs-6.5.3
- dev-dependabot/npm_and_yarn/minimist-1.2.6
- dev-dependabot/npm_and_yarn/node-sass-7.0.0
- dev-dependabot/npm_and_yarn/path-parse-1.0.7
- dev-dependabot/npm_and_yarn/hosted-git-info-2.8.9
- dev-dependabot/npm_and_yarn/lodash-4.17.21
- dev-dependabot/npm_and_yarn/y18n-3.2.2
- dev-changelog-grammar-fixes
This package is auto-updated.
Last update: 2024-11-08 00:01:33 UTC
README
Краткое введение и туториал на русском
Bridge delivers you simple content management system that utilizes best production-tested components and plugins for Yii2.
Installation
Add it as Composer dependency by running
$ composer require yii2-bridge/core
Be sure to configure module (instructions below), before running migrations.
Configuration
Add module declaration to your config file for web config:
<?php return [ // ... your config 'modules' => [ 'admin' => [ 'class' => '\Bridge\Core\BridgeModule', // Add your projects modules here to keep right routing. 'modules' => [ 'customModule' => ['class' => '\app\modules\your\CustomModule'] ], // Add menu item of your content management module to menu 'menu' => [ [ 'title' => 'Content', 'url' => ['/admin/content/default/index'], 'active' => ['module' => 'content'], 'icon' => 'list' ] ], // Alternatively you can define different menu items for different // roles. In that case it will override default menu items, such as // settings, users and dashboard 'composeMenu' => function ($user, $roles, $authManager) { /** * @var \yii\web\User $user * @var \Da\User\Model\Role[] $roles * @var \Da\User\Component\AuthDbManagerComponent $authManager */ if (isset($roles['admin'])) { return require __DIR__ . '/menu-admin.php'; } if ($user->can('editor')) { return require __DIR__ . '/menu-editor.php'; } if (in_array($user->id, $authManager->getUserIdsByRole('manager'))) { return require __DIR__ . '/menu-manager.php'; } // Or any other available method return __DIR__ . '/menu-default.php'; } ] ], 'bootstrap' => [ 'admin' // add module id to bootstrap for proper aliases and url routes binding ] ];
And for console config, in order to run migrations:
<?php return [ // ... your config 'modules' => [ 'admin' => ['class' => '\Bridge\Core\BridgeModule'] ], 'bootstrap' => [ 'admin' // add module id to bootstrap for proper aliases and url routes binding ] ];
Setup
After installing and config setup (including database), you should have installation executable in your vendor folder. You can run all the migrations required with single command:
$ ./vendor/bin/bridge-install
Warning! This command is running with
--interactive=0
flag, which means it will not ask confirmation for it.
Usage
After running every step above you should have your admin panel running on /admin
route.
The only thing left is to run command to create users.
Creating first user
Run following command to generate users:
$ php yii user/create EMAIL USERNAME PASSWORD ROLE
So the correct command to create user with admin role for admin panel would be:
$ php yii user/create admin@sitename.kz admin PASSWORD admin
Gii
Gii that is provided with bridge is packed with some improvements to basic gii.
When generating model with db fields ending by image
or file
, it would
automatically add corresponding upload behavior.
You can turn this behaviors off by clicking on checkbox in generator interface.
And also it has Bridge CRUD generator
, which will generate necessary fields
inputs and display it nicely to the index table.
Development and testing
Configure your .env
(refer to .env.example
). Run migrations with:
$ ./bin/bridge-install-dev
Bridge comes with console app for development and testing purposes, located in bin
folder.
You can simply execute it with
$ php bin/yii.php CONTROLLER/ACTION [params]
Test package with
$ ./vendor/bin/phpunit