Yii2 Practical Application Advanced Template Startup-kit ¶
This is Yii2 startup application template. It was created and developing as a fast start for building an advanced sites based on Yii2. It covers typical use cases for a new project and will help you not to waste your time doing the same work in every project
Note: The application is still under development. Use it at your own risk
FEATURES ¶
Note: Some features are still under development. Please use it at your own risk
- Application Auto Installer includes:
- Application Basic Setup such as Application Name, Cache type, backend/frontend theme etc.
- Admin Account setup
- Mailer Component setup
- Auto migrate required tables required by the the application
- Based on yii2-advanced application template
- Beautiful and open source dashboard theme for backend
- Sign in, Sign up, profile(avatar, locale, personal data) etc
- OAuth authorization
- User management: CRUD
- RBAC
- Yii2 log web interface
- Application events component
- System information web interface
- many other features coming soon
REQUIREMENTS ¶
The minimum requirement by this application template that your Web server supports PHP 5.4.0.
INSTALLATION ¶
Install via Composer ¶
If you do not have Composer, you may install it by following the instructions at getcomposer.org.
You can then install the application using the following command:
composer global require "fxp/composer-asset-plugin:1.0.0"
composer create-project --prefer-dist --stability=dev abhi1693/yii2-app-advanced-startup-kit demo-app
Install from GitHub ¶
Extract the github archive file or clone this repository.
git clone https://github.com/abhi1693/yii2-app-advanced-startup-kit.git
After extraction run
php composer.phar install
GETTING STARTED ¶
After you install the application, just run init
command (without altering anything in the environment
folder)
and select your environment then go to http://yourhost/your-app/
and the application will help you setup everything else.
TESTING ¶
Install additional composer packages:
php composer.phar require --dev "codeception/codeception: 1.8.*@dev" "codeception/specify: *" "codeception/verify: *"
This application boilerplate use database in testing, so you should create three databases that are used in tests:
yii2_practical_unit
- database for unit tests;yii2_practical_functional
- database for functional tests;yii2_practical_acceptance
- database for acceptance tests.
To make your database up to date, you can run in needed test folder yii migrate
, for example
if you are starting from frontend
tests then you should run yii migrate
in each suite folder acceptance
, functional
, unit
it will upgrade your database to the last state according migrations.
To be able to run acceptance tests you need a running webserver. For this you can use the php builtin server and run it in the directory where your main project folder is located. For example if your application is located in /www/practical
all you need to is:
cd /www
and then php -S 127.0.0.1:8080
because the default configuration of acceptance tests expects the url of the application to be /practical/
.
If you already have a server configured or your application is not located in a folder called practical
, you may need to adjust the TEST_ENTRY_URL
in frontend/tests/_bootstrap.php
and backend/tests/_bootstrap.php
.
After that is done you should be able to run your tests, for example to run frontend
tests do:
cd frontend
../vendor/bin/codecept build
../vendor/bin/codecept run
In similar way you can run tests for other application tiers - backend
, console
, common
.
You also can adjust you application suite configs and _bootstrap.php
settings to use other urls and files, as it is can be done in yii2-basic
.
Database Exception – yii\db\Exception
I've got my project updated but I've got this error
SQLSTATE[3D000]: Invalid catalog name: 1046 No database selected
The SQL being executed was: SELECT name, value FROM config
Error Info: Array
(
[0] => 3D000
[1] => 1046
[2] => No database selected
)
↵
Caused by: PDOException
SQLSTATE[3D000]: Invalid catalog name: 1046 No database selected
now when i try to put my db name in app/common/common/config/main.php i got this
Database Exception – yii\db\Exception
SQLSTATE[HY000] [1044] Access denied for user ''@'localhost' to database 'sigac'
↵
Caused by: PDOException
SQLSTATE[HY000] [1044] Access denied for user ''@'localhost' to database 'sigac'
can you help me? thx
Reply: Database Exception – yii\db\Exception
Remove the changes you have made in the
app/common/config/main.php
and tell me what happens when you navigate tolocalhost\your-app\backend
?forbidden
Forbidden
You don't have permission to access /demo-app/backend/ on this server.
Reply: Forbidden
Have you initialized the environment? Please read the documentation carefully before posting issues.
you're totally right
I'm sorry, just one thing, I don't understand which are the site key, so I put a few word but when I going to login as admin it tells me ERROR: Invalid site key
and The captcha is empty. Can you help me?
Remove Captcha
You can read about captcha here
You can remove the captcha, if you want to. Navigate to
vendor/abhi1693/yii2-user/models/AccountLoginForm.php
in your project directory. In that file, comment everything related to captcha. Then navigate tovendor/abhi1693/yii2-user/views/auth/login.php
, similarly, comment the portion displaying the captcha.After this commenting both of these parts, you'll be able to login without the need of the captcha.
I'm sorry for the late reply! Hope this helps you out with your problem.
If you have any questions, please ask in the forum instead.
Signup or Login in order to comment.