Install new laravel project
Here are the steps to install 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/download/
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
Navigate into the newly created project directory:
cd project-name
Step 4: Install dependencies
Run the following command to install the dependencies required by Laravel:
composer install
This may take a few minutes to complete, depending on your internet connection and the speed of your computer.
Step 5: Configure the environment
Laravel comes with a default .env
file that you'll need to configure. Open the file in a text editor and update the following settings:
APP_NAME
: the name of your applicationAPP_ENV
: the environment you're running in (e.g.,local
,staging
,production
)APP_KEY
: a random key generated by Laravel (you can generate a new one usingphp artisan key:generate
)DB_HOST
,DB_DATABASE
,DB_USERNAME
,DB_PASSWORD
: your database settings
Step 6: Run the database migrations
Laravel comes with a set of database migrations that you'll need to run to set up your database. Run the following command:
php artisan migrate
This will create the necessary tables in your database.
Step 7: Start the development server
Run the following command to start the development server:
php artisan serve
This will start a development server that you can access by navigating to http://localhost:8000
in your web browser.
That's it! You now have a brand new Laravel project up and running. You can start building your application by creating controllers, models, and views, and by writing routes in the routes/web.php
file.