Create new project laravel
Here are the steps to create a new Laravel project:
Step 1: Install Composer
If you haven't already, install Composer, the PHP package manager, on your system. You can download it from the official Composer website: https://getcomposer.org/
Step 2: Create a new project
Open your terminal and run the following command to create a new Laravel project:
composer create-project --prefer-dist laravel/laravel project-name
Replace project-name
with the name you want to give your project.
Step 3: Change into the project directory
Once the project is created, change into the project directory:
cd project-name
Step 4: Install dependencies
Run the following command to install the dependencies required by Laravel:
composer install
Step 5: Configure the environment
Create a new file called .env
in the root of your project and configure the environment variables as needed. You can use the .env.example
file as a reference.
Step 6: Generate the application key
Run the following command to generate a new application key:
php artisan key:generate
Step 7: Run the migrations
Run the following command to run the database migrations and create the necessary tables:
php artisan migrate
Step 8: Start the development server
Run the following command to start the development server:
php artisan serve
This will start the server and you can access your project at http://localhost:8000
That's it! You now have a brand new Laravel project up and running.
Additional steps
You may also want to:
- Create a new database and update the
.env
file to reflect the database connection settings. - Run
php artisan db:seed
to seed the database with some sample data. - Create a new route and controller to start building your application.