Laravel, composer and PHP artisan
Laravel, composer and PHP artisan
- Laravel và composer
- Creat laravel project:
composer create-project --prefer-dist laravel/laravel project_name
Ex: Create laravel project name todolist
composer create-project --prefer-dist laravel/laravel todolist
- Build project locahost:
php artisan serve
- Set project key:
php artisan key:generate
- To turn on maintenance mode, use artisan down
php artisan down
- Check the current version of laravel installation?
php artisan –version
// Output:
// Laravel Framework version 5.2.45
// Output:
// Laravel Framework version 5.2.45
- Put Laravel application in “maintenance mode”
php artisan down
// Output:
// Application is now in maintenance mode.
// Output:
// Application is now in maintenance mode.
- Display the environment laravel is running
php artisan env
// Output:
// Current application environment: local
// Output:
// Current application environment: local
- Run Database migrations
php artisan migrate
// This executes all the defined migrations and create database tables.
// This executes all the defined migrations and create database tables.
- To start Laravel project.
php artisan serve By, default this hosts the application locally at localhost:8000
// You can server with different hostname and post using “–host” and “–port” options respectively.
// php artisan up
// Bring UP the laravel application out of maintenance mode
// You can server with different hostname and post using “–host” and “–port” options respectively.
// php artisan up
// Bring UP the laravel application out of maintenance mode
- Flush the expired password tokens
php artisan auth:clear-resets
- Flush the application cache
php artisan cache:clear
- Create a migration for the cache database table
php artisan cache:table
- Create a cache file for faster configuration loading
php artisan config:cache
- Remove the configuration cache file
php artisan config:clear
- Scaffold basic login and registration views and routes
php artisan make:auth
- Create a new controller class using artisan command
php artisan make:controller TechCluesBlog
- Create a new migration file.
php artisan make:migration my_blog_post
// Output:
// Created Migration: 2019_01_27_094045_my_blog_post
// The new migration file 2019_01_27_094045_my_blog_post.php will be created under ../database/migrations./
// Output:
// Created Migration: 2019_01_27_094045_my_blog_post
// The new migration file 2019_01_27_094045_my_blog_post.php will be created under ../database/migrations./
- Create a new Eloquent model class.
php artisan make:model MyBlogPost
// Output:
// Model created successfully.
// The new Model file “MyBlogPost.php” will be created in app/Models or ../app/..
// Output:
// Model created successfully.
// The new Model file “MyBlogPost.php” will be created in app/Models or ../app/..
- List all registered routes
php artisan route:list
- Remove the route cache file
php artisan route:clear
- Create a route cache file for faster route registration
php artisan route:cache
- Publish any publishable assets from vendor packages
php artisan vendor:publish
- Clear all compiled view files
php artisan view:clear
Nhận xét
Đăng nhận xét