Debug School

rakesh kumar
rakesh kumar

Posted on • Updated on

How to create project Laravel 9

create project

composer create-project --prefer-dist laravel/laravel: wz-organisation-ms
Enter fullscreen mode Exit fullscreen mode

==============================OR============================================

composer create-project --prefer-dist laravel/laravel: wz-organisation-ms
Enter fullscreen mode Exit fullscreen mode

composer install
composer install is a command used to install the dependencies specified in a Laravel or PHP project's composer.json file. The composer.json file contains information about the project and its dependencies, including the required versions of libraries and packages, and other information needed to run the project.Composer is a package manager for PHP that helps manage the dependencies in a project. When you run composer install, it reads the composer.json file and downloads the specified dependencies into the vendor directory of the project. This makes it easier to manage the dependencies, as well as makes it easier to set up a development environment and deploy the project to a production environment.By using composer install, you can ensure that your project has all the dependencies it needs to run correctly, and that the versions of those dependencies are the ones specified in the composer.json file.

Composer is a dependency manager for PHP, and it is used in Laravel to manage and install the packages and libraries required for a Laravel project.

Laravel uses many libraries and packages from other developers, such as Symfony, Guzzle, and others, which are installed and managed via Composer. This makes it easy for developers to add and update these dependencies in their Laravel projects, without having to manually download, install, and manage them.

Additionally, Composer also helps in maintaining a consistent version of the dependencies and libraries used in a project, which helps in avoiding compatibility issues and makes it easier to manage the project over time.

In summary, Composer is essential for Laravel development as it simplifies the process of managing dependencies, libraries, and packages, and ensures consistency and compatibility in a Laravel project.

composer install
Enter fullscreen mode Exit fullscreen mode

Install the Laravel UI package
"php artisan ui bootstrap --auth" is used in Laravel to set up a basic user authentication system, which includes the views and routes needed for registration, login, and password reset functionality. The "ui" option specifies the frontend user interface framework to be used, which is Bootstrap in this case, while the "--auth" option sets up the authentication scaffolding.Using this command saves time and effort by generating the necessary files and code snippets for the authentication system, which can then be customized and extended as needed for a specific project.

composer require laravel/ui
Enter fullscreen mode Exit fullscreen mode

Set up a basic user authentication
"php artisan ui bootstrap --auth" is used in Laravel to set up a basic user authentication system, which includes the views and routes needed for registration, login, and password reset functionality. The "ui" option specifies the frontend user interface framework to be used, which is Bootstrap in this case, while the "--auth" option sets up the authentication scaffolding.Using this command saves time and effort by generating the necessary files and code snippets for the authentication system, which can then be customized and extended as needed for a specific project.

php artisan ui bootstrap --auth
Enter fullscreen mode Exit fullscreen mode

Image description

Set up databse name in env

Image description

Run php artisan optimize

The command "php artisan optimize" is used to optimize the framework's bootstrapping process. It caches various configurations and routes into a single file, reducing the number of files that need to be loaded and improving the performance of

php artisan optimize
Enter fullscreen mode Exit fullscreen mode

install the Laravel Passport package in a Laravel application
"composer require laravel/passport" is a command used to install the Laravel Passport package in a Laravel application. Passport is a Laravel package that provides a simple and easy way to handle API authentication.

composer require laravel/passport
Enter fullscreen mode Exit fullscreen mode

Add inside config/app.php

 Laravel\Passport\PassportServiceProvider::class,
Enter fullscreen mode Exit fullscreen mode
'providers' => [

        /*
         * Laravel Framework Service Providers...
         */
        Illuminate\Auth\AuthServiceProvider::class,
        Illuminate\Broadcasting\BroadcastServiceProvider::class,
        Illuminate\Bus\BusServiceProvider::class,
        Illuminate\Cache\CacheServiceProvider::class,
        Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class,

        /*
         * Application Service Providers...
         */
        App\Providers\AppServiceProvider::class,
        App\Providers\AuthServiceProvider::class,
        // App\Providers\BroadcastServiceProvider::class,
        App\Providers\EventServiceProvider::class,
        App\Providers\RouteServiceProvider::class,

        Laravel\Passport\PassportServiceProvider::class,

    ],
Enter fullscreen mode Exit fullscreen mode

Add inside config/auth.php

Image description

Add inside Http/kernal.php

'client_credentials' => \Laravel\Passport\Http\Middleware\CheckClientCredentials::class,
Enter fullscreen mode Exit fullscreen mode

Image description

migrate table
php artisan migrate

Passport install

php artisan passport:install
Enter fullscreen mode Exit fullscreen mode

Image description

Give Permission
chmod -R 777 storage
chmod -R 777 storage/logs

place pull.sh script
inside it put

Image description

setup root to daemon
change-file-permissions-recursively

Image description

Image description

Image description

Top comments (0)