Create new laravel application
Here are the steps to create a new Laravel application:
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 Laravel 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
Step 5: Configure the environment
Create a new file called .env
in the root of your project and configure your environment variables. 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 application by navigating to http://localhost:8000
in your web browser.
That's it! You now have a brand new Laravel application up and running.
Additional steps
You may also want to:
- Create a new database and update the
.env
file to reflect the new database credentials. - Run
php artisan db:seed
to seed the database with some sample data. - Create a new route and controller to handle requests.
- Start building your application!