Application is a simple blog website based on Yii2 Advanced Project Template
- Create\Edit\Hide\Show\Delete posts.
- Create\Edit\Delete tags.
- Hide\Show\Delete comments.
- Searching posts by tags.
- View post.
- Adding comments.
- Sending notifications about comments to page admin.
- Contact form.
- Creating account for admin.
- PHP > 5.6
- Composer
-
Clone or download repository to any folder on your web server.
-
Inside root folder run the application initialization command.
php init --env=Production --overwrite=All
-
Inside root folder install required composer dependencies.
composer update
-
Log to your database and create database.
CREATE SCHEMA `database_name`;
-
Run following migrations inside root folder using terminal:
php yii migrate php yii migrate/up --migrationPath=@vendor/dektrium/yii2-user/migrations
-
Set your database connection by adjust settings under
components['db']
key in yourcommon/config/main-local.php
file. -
Set mailer configuration in
components['mailer']
key in yourfrontend/config/main-local.php
file. Example:'components' => [ 'mailer' => [ 'class' => 'yii\swiftmailer\Mailer', 'viewPath' => '@frontend/mail', 'transport' => [ 'class' => 'Swift_SmtpTransport', 'host' => 'smtp.gmail.com', 'username' => '[email protected]', 'password' => 'password', 'port' => '587', 'encryption' => 'tls', ], 'useFileTransport' => false, ], ]
-
Create admin account.
php yii user/create <email> <user_name> <password>
-
Add following host configuration to your apache host file and adjust
Directory
,DocumentRoot
andServerName
<VirtualHost *:80> ServerName blog.com DocumentRoot /path-to/root/folder/blog <Directory /path-to/root/folder/blog> Options Indexes FollowSymLinks AllowOverride All DirectoryIndex index.php Order allow,deny Allow from all </Directory> </VirtualHost>
-
Change the hosts file to point the domain to your server.
- for Windows:
c:\Windows\System32\Drivers\etc\hosts
- for Linux:
/etc/hosts
Add the following line:
127.0.0.1 blog
- for Windows:
-
Noww you can run blog site using following urls:
- for frontend:
http://blog
- admin section
http://blog/admin
If you have any problems visit Yii2 Documentation or contact with me.