Tutorial Laravel 11 #2 : Cara Install dan Menjalankan Laravel 11
Summary
TLDRIn this tutorial, viewers will learn how to install and run a Laravel 11 project, covering essential steps such as installing Composer, creating a new Laravel project, and running it locally using the `php artisan serve` command. The video also explains the process of creating a symbolic storage link to ensure that files uploaded to the `storage` folder are publicly accessible. This beginner-friendly guide offers clear instructions for getting started with Laravel 11, making it an excellent resource for those new to the framework or looking to upgrade to the latest version.
Takeaways
- 😀 Composer is a PHP package manager required to work with Laravel projects. Make sure it's installed on your machine.
- 😀 Laravel 11 requires PHP version 8.2 or higher. If you use an older PHP version (like 8.1), Laravel's version may be lower.
- 😀 To create a Laravel 11 project, run the Composer command: `composer create-project --prefer-dist laravel/laravel project-name 11`.
- 😀 Ensure you are connected to the internet when installing Laravel, as the project files will be downloaded from the internet.
- 😀 After installation, navigate to the project folder using `cd project-name` and run `php artisan serve` to start the local server.
- 😀 Laravel's local server will run by default on `localhost:8000`. Open your browser to this URL to see your project in action.
- 😀 Storage links are necessary to link files in the `storage` folder to the `public` folder for easy access by Laravel.
- 😀 To create the storage link, run the command `php artisan storage:link`, which links `storage/app/public` to `public/storage`.
- 😀 Laravel can only serve files from the `public` folder, so the storage link is essential for uploaded files to be accessible.
- 😀 After setting up the storage link, any files uploaded will be accessible via the public URL, thanks to the symlink created.
- 😀 The tutorial ends with a reminder that the next video will cover creating models and migrations in Laravel 11.
Q & A
What is Composer, and why is it necessary for installing Laravel?
-Composer is a dependency manager for PHP, used to manage libraries and packages needed for a Laravel project. It is necessary for installing Laravel because it ensures the required PHP dependencies are correctly installed and managed.
How can I verify if Composer is successfully installed on my system?
-You can verify the installation by running the command `composer` in your terminal. If Composer is installed correctly, it will display version information and other details about the Composer setup.
What PHP version is required to install Laravel 11?
-Laravel 11 requires PHP version 8.2 or higher. If you use an older PHP version, such as 8.1, Laravel will install a compatible version of the framework.
What command should I use to create a new Laravel 11 project?
-To create a new Laravel 11 project, you should use the command `composer create-project --prefer-dist laravel/laravel project-name '11.*'`. Replace 'project-name' with your desired project name.
Where should I place my Laravel project when using XAMPP?
-When using XAMPP, Laravel projects should be placed in the `htdocs` folder. This is the root directory for web files when running the local server.
What does the `php artisan serve` command do?
-`php artisan serve` starts a local development server for your Laravel project. By default, the server runs on `http://localhost:8000`, allowing you to view your project in a web browser.
What should I do if I want to access my Laravel project through a different port?
-If you wish to use a different port, you can specify it by running the command `php artisan serve --port=PORT_NUMBER`, where `PORT_NUMBER` is the port you want to use.
What is the purpose of the storage link in Laravel, and how do I create it?
-The storage link creates a symbolic link between the `storage/app/public` folder and the `public/storage` folder. This allows files uploaded to the `storage` folder to be publicly accessible via the web. To create the link, run `php artisan storage:link`.
Why does Laravel require a storage link to access uploaded files?
-Laravel requires a storage link because uploaded files are stored in the `storage` folder, which is not publicly accessible. The symbolic link allows these files to be accessed through the public folder, enabling users to view or download them.
What should I do if the `php artisan storage:link` command fails?
-If the `php artisan storage:link` command fails, ensure that the `public` folder has write permissions and that the symbolic link is not being blocked by system restrictions or permissions. You may need to adjust folder permissions or run the command with administrative privileges.
Outlines
هذا القسم متوفر فقط للمشتركين. يرجى الترقية للوصول إلى هذه الميزة.
قم بالترقية الآنMindmap
هذا القسم متوفر فقط للمشتركين. يرجى الترقية للوصول إلى هذه الميزة.
قم بالترقية الآنKeywords
هذا القسم متوفر فقط للمشتركين. يرجى الترقية للوصول إلى هذه الميزة.
قم بالترقية الآنHighlights
هذا القسم متوفر فقط للمشتركين. يرجى الترقية للوصول إلى هذه الميزة.
قم بالترقية الآنTranscripts
هذا القسم متوفر فقط للمشتركين. يرجى الترقية للوصول إلى هذه الميزة.
قم بالترقية الآن5.0 / 5 (0 votes)