Creating new laravel project
To create a new Laravel project, you can use the following steps:
Method 1: Using Composer
- Open your terminal or command prompt.
- Run the following command to create a new Laravel project:
composer create-project --prefer-dist laravel/laravel project-name
Replace
project-name
with the desired name of your project.
Method 2: Using Laravel Installer
- Open your terminal or command prompt.
- Run the following command to install Laravel:
composer global require laravel/installer
- Once installed, navigate to the directory where you want to create your project and run:
laravel new project-name
Replace
project-name
with the desired name of your project.
Method 3: Using Laravel's Official Website
- Go to the Laravel website (www.laravel.com) and click on the "Create a New Project" button.
- Fill in the required information, such as project name, email, and password.
- Click on the "Create Project" button to download the project files.
Common Options
When creating a new Laravel project, you can also specify some common options:
--prefer-dist
: This option tells Composer to download the project in a compressed format, which can save time and disk space.--dev
: This option installs the project in development mode, which includes additional dependencies and tools for development.--public
: This option specifies the public directory for the project, which is where the project's public files will be stored.
Post-Installation Steps
After creating a new Laravel project, you'll need to follow these post-installation steps:
- Change into the project directory:
cd project-name
- Run the following command to install the project's dependencies:
composer install
- Run the following command to generate the project's key:
php artisan key:generate
- Run the following command to migrate the project's database:
php artisan migrate
- Run the following command to seed the project's database (optional):
php artisan db:seed
- Start the project's development server:
php artisan serve
You can now access your new Laravel project by navigating to
http://localhost:8000
in your web browser.