Laravel PHP commands
Install Composer, run the following script in your terminal:
# curl -sS https://getcomposer.org/installer | sudo php — –install-dir=/usr/local/bin –filename=composer
Install the Laravel CLI globally, run the following Composer command:
# composer global require “laravel/installer”
Create a new project with Laravel
# laravel new <PROJECT-NAME>
Clear laravel cache
# php artisan cache:clear
Start PHP server on port 8000
# cd <PROJECT-NAME>
# php artisan serve
Restart Apache web server on ubuntu
# /etc/init.d/apache2 restart
Install Laravel Passport
# composer require laravel/passport
Create a controller
# php artisan make:controller NameController
Create a model
# php artisan make:model -mr
Create migrations using following command
# php artisan make:migration create__table
To execute the migrations and write to the database:
# php artisan migrate
Make Database Seeders (Will automatically insert dummy data into the database)
# php artisan make:seeder <TableName>Seeder
e.g: php artisan make:seeder UsersTableSeeder
Run database seeders (After updating database/DatabaseSeeder.php file)
# php artisan db:seed (This will update the database with dummy data)
Run the passport installation (create keys for securing application)
# php artisan passport:install
Test the application locally
# php artisan serve
To check full route list
# php artisan route:list
Ready to Solve Your Most Complex Technical Challenges?
Our senior advisors are ready to help you navigate the ever-evolving technology landscape with precision and expertise.
Schedule a ConsultationRelated Articles
Laravel Interview Questions
Basic Laravel Interview Questions Q1: What is Laravel? Why is it used?A: Laravel is an open-source PHP framework designed for web application…
Solution for WordPress “too many redirects” issue
The “Too Many Redirects” issue on WordPress usually occurs due to misconfiguration in the site’s URL settings, SSL setup, or conflicts between…
PHP logic to reverse a string
<?php// Function to reverse a given stringfunction reverseText($text) { // Get the length of the input text $textLength = strlen($text); // Initialize…