Instalasi Composer dan Laravel
Bismillahirrahmanirrahim.
Composer adalah aplikasi manajer paket untuk bahasa pemrograman PHP yang menyediakan format standar untuk mengelola dependensi PHP dan pustaka-pustaka yang diperlukan. (Wikipedia)
Dengan demikian, composer ini dapat digunakan untuk menghemat waktu pengembangan aplikasi berbasis PHP karena kemudahan menginstal paket-paket yang dibutuhkan.
Instal Composer
Jalankan perintah berikut melalui terminal untuk menginstal composer.
sudo pacman -S composer
Paket yang diinstal:
resolving dependencies...
looking for conflicting packages...
Packages (2) unzip-6.0-14 composer-2.0.11-1
Total Download Size: 0.56 MiB
Total Installed Size: 2.42 MiB
:: Proceed with installation? [Y/n] #Press enter
Periksa hasil instalasi dengan perintah composer --version
:
composer --version
Composer version 2.0.11 2021-02-24 14:57:23 #Output
Menglobalkan Direktori Composer
Jalankan perintah:
composer global require "laravel/installer"
Dengan perintah ini akan menampilkan proses yang kurang lebih seperti berikut:
Changed current directory to /home/fajri/.config/composer
Using version ^4.2 for laravel/installer
./composer.json has been created
Running composer update laravel/installer
Loading composer repositories with package information
Updating dependencies
Lock file operations: 12 installs, 0 updates, 0 removals
- Locking laravel/installer (v4.2.4)
- Locking psr/container (1.1.1)
- Locking symfony/console (v5.2.6)
- Locking symfony/polyfill-ctype (v1.22.1)
- Locking symfony/polyfill-intl-grapheme (v1.22.1)
- Locking symfony/polyfill-intl-normalizer (v1.22.1)
- Locking symfony/polyfill-mbstring (v1.22.1)
- Locking symfony/polyfill-php73 (v1.22.1)
- Locking symfony/polyfill-php80 (v1.22.1)
- Locking symfony/process (v5.2.4)
- Locking symfony/service-contracts (v2.2.0)
- Locking symfony/string (v5.2.6)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 12 installs, 0 updates, 0 removals
- Downloading symfony/polyfill-php80 (v1.22.1)
- Downloading symfony/process (v5.2.4)
- Downloading symfony/polyfill-mbstring (v1.22.1)
- Downloading symfony/polyfill-intl-normalizer (v1.22.1)
- Downloading symfony/polyfill-intl-grapheme (v1.22.1)
- Downloading symfony/polyfill-ctype (v1.22.1)
- Downloading symfony/string (v5.2.6)
- Downloading psr/container (1.1.1)
- Downloading symfony/service-contracts (v2.2.0)
- Downloading symfony/polyfill-php73 (v1.22.1)
- Downloading symfony/console (v5.2.6)
- Downloading laravel/installer (v4.2.4)
- Installing symfony/polyfill-php80 (v1.22.1): Extracting archive
- Installing symfony/process (v5.2.4): Extracting archive
- Installing symfony/polyfill-mbstring (v1.22.1): Extracting archive
- Installing symfony/polyfill-intl-normalizer (v1.22.1): Extracting archive
- Installing symfony/polyfill-intl-grapheme (v1.22.1): Extracting archive
- Installing symfony/polyfill-ctype (v1.22.1): Extracting archive
- Installing symfony/string (v5.2.6): Extracting archive
- Installing psr/container (1.1.1): Extracting archive
- Installing symfony/service-contracts (v2.2.0): Extracting archive
- Installing symfony/polyfill-php73 (v1.22.1): Extracting archive
- Installing symfony/console (v5.2.6): Extracting archive
- Installing laravel/installer (v4.2.4): Extracting archive
6 package suggestions were added by new dependencies, use `composer suggest` to see details.
Generating autoload files
10 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
Jadikan direktori ~/.composer/vendor/bin/
menjadi direktori global dengan mengedit file ~/.bashrc
:
nano ~/.bashrc
Lalu tambahkan dua baris di bawah ini di bagian akhir file:
export PATH=$PATH:$HOME/.config/composer/vendor/bin
Simpan dan tutup file. Tutup terminal dan buka kembali.
Instal Laravel Menggunakan Laravel Installer atau Composer
Setelah composer/vendor/bin
menjadi folder global, laravel pun sudah dapat diinstal. Sebelum menginstal laravel, pastikan letak direktori yang diinginkan misalnya di direktori ~/
yang menunjukkan direktori home
. Setelah selesai, instal laravel dengan perintah:
laravel new blog
Akan ditampilkan output:
_ _
| | | |
| | __ _ _ __ __ ___ _____| |
| | / _` | '__/ _` \ \ / / _ \ |
| |___| (_| | | | (_| |\ V / __/ |
|______\__,_|_| \__,_| \_/ \___|_|
Creating a "laravel/laravel" project at "./blog"
Installing laravel/laravel (v8.5.15)
- Downloading laravel/laravel (v8.5.15)
- Installing laravel/laravel (v8.5.15): Extracting archive
Created project in /home/fajri/blog
> @php -r "file_exists('.env') || copy('.env.example', '.env');"
Loading composer repositories with package information
Updating dependencies
Lock file operations: 105 installs, 0 updates, 0 removals
- Locking asm89/stack-cors (v2.0.3)
- Locking brick/math (0.9.2)
- Locking dnoegel/php-xdg-base-dir (v0.1.1)
- Locking doctrine/inflector (2.0.3)
- Locking doctrine/instantiator (1.4.0)
- Locking doctrine/lexer (1.2.1)
- Locking dragonmantank/cron-expression (v3.1.0)
- Locking egulias/email-validator (2.1.25)
- Locking facade/flare-client-php (1.5.0)
- Locking facade/ignition (2.7.0)
- Locking facade/ignition-contracts (1.0.2)
- Locking fakerphp/faker (v1.14.1)
- Locking fideloper/proxy (4.4.1)
- Locking filp/whoops (2.12.0)
- Locking fruitcake/laravel-cors (v2.0.3)
- Locking graham-campbell/result-type (v1.0.1)
- Locking guzzlehttp/guzzle (7.3.0)
- Locking guzzlehttp/promises (1.4.1)
- Locking guzzlehttp/psr7 (1.8.1)
- Locking hamcrest/hamcrest-php (v2.0.1)
- Locking laravel/framework (v8.35.1)
- Locking laravel/sail (v1.4.10)
- Locking laravel/tinker (v2.6.1)
- Locking league/commonmark (1.5.8)
- Locking league/flysystem (1.1.3)
- Locking league/mime-type-detection (1.7.0)
- Locking mockery/mockery (1.4.3)
- Locking monolog/monolog (2.2.0)
- Locking myclabs/deep-copy (1.10.2)
- Locking nesbot/carbon (2.46.0)
- Locking nikic/php-parser (v4.10.4)
- Locking nunomaduro/collision (v5.3.0)
- Locking opis/closure (3.6.1)
- Locking phar-io/manifest (2.0.1)
- Locking phar-io/version (3.1.0)
- Locking phpdocumentor/reflection-common (2.2.0)
- Locking phpdocumentor/reflection-docblock (5.2.2)
- Locking phpdocumentor/type-resolver (1.4.0)
- Locking phpoption/phpoption (1.7.5)
- Locking phpspec/prophecy (1.13.0)
- Locking phpunit/php-code-coverage (9.2.6)
- Locking phpunit/php-file-iterator (3.0.5)
- Locking phpunit/php-invoker (3.1.1)
- Locking phpunit/php-text-template (2.0.4)
- Locking phpunit/php-timer (5.0.3)
- Locking phpunit/phpunit (9.5.4)
- Locking psr/container (1.1.1)
- Locking psr/event-dispatcher (1.0.0)
- Locking psr/http-client (1.0.1)
- Locking psr/http-message (1.0.1)
- Locking psr/log (1.1.3)
- Locking psr/simple-cache (1.0.1)
- Locking psy/psysh (v0.10.7)
- Locking ralouphie/getallheaders (3.0.3)
- Locking ramsey/collection (1.1.3)
- Locking ramsey/uuid (4.1.1)
- Locking sebastian/cli-parser (1.0.1)
- Locking sebastian/code-unit (1.0.8)
- Locking sebastian/code-unit-reverse-lookup (2.0.3)
- Locking sebastian/comparator (4.0.6)
- Locking sebastian/complexity (2.0.2)
- Locking sebastian/diff (4.0.4)
- Locking sebastian/environment (5.1.3)
- Locking sebastian/exporter (4.0.3)
- Locking sebastian/global-state (5.0.2)
- Locking sebastian/lines-of-code (1.0.3)
- Locking sebastian/object-enumerator (4.0.4)
- Locking sebastian/object-reflector (2.0.4)
- Locking sebastian/recursion-context (4.0.4)
- Locking sebastian/resource-operations (3.0.3)
- Locking sebastian/type (2.3.1)
- Locking sebastian/version (3.0.2)
- Locking swiftmailer/swiftmailer (v6.2.7)
- Locking symfony/console (v5.2.6)
- Locking symfony/css-selector (v5.2.4)
- Locking symfony/deprecation-contracts (v2.2.0)
- Locking symfony/error-handler (v5.2.6)
- Locking symfony/event-dispatcher (v5.2.4)
- Locking symfony/event-dispatcher-contracts (v2.2.0)
- Locking symfony/finder (v5.2.4)
- Locking symfony/http-client-contracts (v2.3.1)
- Locking symfony/http-foundation (v5.2.4)
- Locking symfony/http-kernel (v5.2.6)
- Locking symfony/mime (v5.2.6)
- Locking symfony/polyfill-ctype (v1.22.1)
- Locking symfony/polyfill-iconv (v1.22.1)
- Locking symfony/polyfill-intl-grapheme (v1.22.1)
- Locking symfony/polyfill-intl-idn (v1.22.1)
- Locking symfony/polyfill-intl-normalizer (v1.22.1)
- Locking symfony/polyfill-mbstring (v1.22.1)
- Locking symfony/polyfill-php72 (v1.22.1)
- Locking symfony/polyfill-php73 (v1.22.1)
- Locking symfony/polyfill-php80 (v1.22.1)
- Locking symfony/process (v5.2.4)
- Locking symfony/routing (v5.2.6)
- Locking symfony/service-contracts (v2.2.0)
- Locking symfony/string (v5.2.6)
- Locking symfony/translation (v5.2.6)
- Locking symfony/translation-contracts (v2.3.0)
- Locking symfony/var-dumper (v5.2.6)
- Locking theseer/tokenizer (1.2.0)
- Locking tijsverkoyen/css-to-inline-styles (2.2.3)
- Locking vlucas/phpdotenv (v5.3.0)
- Locking voku/portable-ascii (1.5.6)
- Locking webmozart/assert (1.10.0)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 105 installs, 0 updates, 0 removals
- Downloading doctrine/inflector (2.0.3)
- Downloading doctrine/lexer (1.2.1)
- Downloading webmozart/assert (1.10.0)
- Downloading dragonmantank/cron-expression (v3.1.0)
- Downloading symfony/var-dumper (v5.2.6)
- Downloading psr/log (1.1.3)
- Downloading monolog/monolog (2.2.0)
- Downloading voku/portable-ascii (1.5.6)
- Downloading phpoption/phpoption (1.7.5)
- Downloading graham-campbell/result-type (v1.0.1)
- Downloading vlucas/phpdotenv (v5.3.0)
- Downloading symfony/css-selector (v5.2.4)
- Downloading tijsverkoyen/css-to-inline-styles (2.2.3)
- Downloading symfony/deprecation-contracts (v2.2.0)
- Downloading symfony/routing (v5.2.6)
- Downloading symfony/polyfill-php72 (v1.22.1)
- Downloading symfony/polyfill-intl-idn (v1.22.1)
- Downloading symfony/mime (v5.2.6)
- Downloading symfony/http-foundation (v5.2.4)
- Downloading symfony/http-client-contracts (v2.3.1)
- Downloading psr/event-dispatcher (1.0.0)
- Downloading symfony/event-dispatcher-contracts (v2.2.0)
- Downloading symfony/event-dispatcher (v5.2.4)
- Downloading symfony/error-handler (v5.2.6)
- Downloading symfony/http-kernel (v5.2.6)
- Downloading symfony/finder (v5.2.4)
- Downloading symfony/polyfill-iconv (v1.22.1)
- Downloading egulias/email-validator (2.1.25)
- Downloading swiftmailer/swiftmailer (v6.2.7)
- Downloading ramsey/collection (1.1.3)
- Downloading brick/math (0.9.2)
- Downloading ramsey/uuid (4.1.1)
- Downloading psr/simple-cache (1.0.1)
- Downloading opis/closure (3.6.1)
- Downloading symfony/translation-contracts (v2.3.0)
- Downloading symfony/translation (v5.2.6)
- Downloading nesbot/carbon (2.46.0)
- Downloading league/mime-type-detection (1.7.0)
- Downloading league/flysystem (1.1.3)
- Downloading league/commonmark (1.5.8)
- Downloading laravel/framework (v8.35.1)
- Downloading filp/whoops (2.12.0)
- Downloading facade/ignition-contracts (1.0.2)
- Downloading facade/flare-client-php (1.5.0)
- Downloading facade/ignition (2.7.0)
- Downloading fakerphp/faker (v1.14.1)
- Downloading fideloper/proxy (4.4.1)
- Downloading asm89/stack-cors (v2.0.3)
- Downloading fruitcake/laravel-cors (v2.0.3)
- Downloading psr/http-message (1.0.1)
- Downloading psr/http-client (1.0.1)
- Downloading ralouphie/getallheaders (3.0.3)
- Downloading guzzlehttp/psr7 (1.8.1)
- Downloading guzzlehttp/promises (1.4.1)
- Downloading guzzlehttp/guzzle (7.3.0)
- Downloading laravel/sail (v1.4.10)
- Downloading nikic/php-parser (v4.10.4)
- Downloading dnoegel/php-xdg-base-dir (v0.1.1)
- Downloading psy/psysh (v0.10.7)
- Downloading laravel/tinker (v2.6.1)
- Downloading hamcrest/hamcrest-php (v2.0.1)
- Downloading mockery/mockery (1.4.3)
- Downloading nunomaduro/collision (v5.3.0)
- Downloading phpdocumentor/reflection-common (2.2.0)
- Downloading phpdocumentor/type-resolver (1.4.0)
- Downloading phpdocumentor/reflection-docblock (5.2.2)
- Downloading sebastian/version (3.0.2)
- Downloading sebastian/type (2.3.1)
- Downloading sebastian/resource-operations (3.0.3)
- Downloading sebastian/recursion-context (4.0.4)
- Downloading sebastian/object-reflector (2.0.4)
- Downloading sebastian/object-enumerator (4.0.4)
- Downloading sebastian/global-state (5.0.2)
- Downloading sebastian/exporter (4.0.3)
- Downloading sebastian/environment (5.1.3)
- Downloading sebastian/diff (4.0.4)
- Downloading sebastian/comparator (4.0.6)
- Downloading sebastian/code-unit (1.0.8)
- Downloading sebastian/cli-parser (1.0.1)
- Downloading phpunit/php-timer (5.0.3)
- Downloading phpunit/php-text-template (2.0.4)
- Downloading phpunit/php-invoker (3.1.1)
- Downloading phpunit/php-file-iterator (3.0.5)
- Downloading theseer/tokenizer (1.2.0)
- Downloading sebastian/lines-of-code (1.0.3)
- Downloading sebastian/complexity (2.0.2)
- Downloading sebastian/code-unit-reverse-lookup (2.0.3)
- Downloading phpunit/php-code-coverage (9.2.6)
- Downloading doctrine/instantiator (1.4.0)
- Downloading phpspec/prophecy (1.13.0)
- Downloading phar-io/version (3.1.0)
- Downloading phar-io/manifest (2.0.1)
- Downloading myclabs/deep-copy (1.10.2)
- Downloading phpunit/phpunit (9.5.4)
- Installing doctrine/inflector (2.0.3): Extracting archive
- Installing doctrine/lexer (1.2.1): Extracting archive
- Installing symfony/polyfill-ctype (v1.22.1): Extracting archive
- Installing webmozart/assert (1.10.0): Extracting archive
- Installing dragonmantank/cron-expression (v3.1.0): Extracting archive
- Installing symfony/polyfill-php80 (v1.22.1): Extracting archive
- Installing symfony/polyfill-mbstring (v1.22.1): Extracting archive
- Installing symfony/var-dumper (v5.2.6): Extracting archive
- Installing symfony/polyfill-intl-normalizer (v1.22.1): Extracting archive
- Installing symfony/polyfill-intl-grapheme (v1.22.1): Extracting archive
- Installing symfony/string (v5.2.6): Extracting archive
- Installing psr/container (1.1.1): Extracting archive
- Installing symfony/service-contracts (v2.2.0): Extracting archive
- Installing symfony/polyfill-php73 (v1.22.1): Extracting archive
- Installing symfony/console (v5.2.6): Extracting archive
- Installing psr/log (1.1.3): Extracting archive
- Installing monolog/monolog (2.2.0): Extracting archive
- Installing voku/portable-ascii (1.5.6): Extracting archive
- Installing phpoption/phpoption (1.7.5): Extracting archive
- Installing graham-campbell/result-type (v1.0.1): Extracting archive
- Installing vlucas/phpdotenv (v5.3.0): Extracting archive
- Installing symfony/css-selector (v5.2.4): Extracting archive
- Installing tijsverkoyen/css-to-inline-styles (2.2.3): Extracting archive
- Installing symfony/deprecation-contracts (v2.2.0): Extracting archive
- Installing symfony/routing (v5.2.6): Extracting archive
- Installing symfony/process (v5.2.4): Extracting archive
- Installing symfony/polyfill-php72 (v1.22.1): Extracting archive
- Installing symfony/polyfill-intl-idn (v1.22.1): Extracting archive
- Installing symfony/mime (v5.2.6): Extracting archive
- Installing symfony/http-foundation (v5.2.4): Extracting archive
- Installing symfony/http-client-contracts (v2.3.1): Extracting archive
- Installing psr/event-dispatcher (1.0.0): Extracting archive
- Installing symfony/event-dispatcher-contracts (v2.2.0): Extracting archive
- Installing symfony/event-dispatcher (v5.2.4): Extracting archive
- Installing symfony/error-handler (v5.2.6): Extracting archive
- Installing symfony/http-kernel (v5.2.6): Extracting archive
- Installing symfony/finder (v5.2.4): Extracting archive
- Installing symfony/polyfill-iconv (v1.22.1): Extracting archive
- Installing egulias/email-validator (2.1.25): Extracting archive
- Installing swiftmailer/swiftmailer (v6.2.7): Extracting archive
- Installing ramsey/collection (1.1.3): Extracting archive
- Installing brick/math (0.9.2): Extracting archive
- Installing ramsey/uuid (4.1.1): Extracting archive
- Installing psr/simple-cache (1.0.1): Extracting archive
- Installing opis/closure (3.6.1): Extracting archive
- Installing symfony/translation-contracts (v2.3.0): Extracting archive
- Installing symfony/translation (v5.2.6): Extracting archive
- Installing nesbot/carbon (2.46.0): Extracting archive
- Installing league/mime-type-detection (1.7.0): Extracting archive
- Installing league/flysystem (1.1.3): Extracting archive
- Installing league/commonmark (1.5.8): Extracting archive
- Installing laravel/framework (v8.35.1): Extracting archive
- Installing filp/whoops (2.12.0): Extracting archive
- Installing facade/ignition-contracts (1.0.2): Extracting archive
- Installing facade/flare-client-php (1.5.0): Extracting archive
- Installing facade/ignition (2.7.0): Extracting archive
- Installing fakerphp/faker (v1.14.1): Extracting archive
- Installing fideloper/proxy (4.4.1): Extracting archive
- Installing asm89/stack-cors (v2.0.3): Extracting archive
- Installing fruitcake/laravel-cors (v2.0.3): Extracting archive
- Installing psr/http-message (1.0.1): Extracting archive
- Installing psr/http-client (1.0.1): Extracting archive
- Installing ralouphie/getallheaders (3.0.3): Extracting archive
- Installing guzzlehttp/psr7 (1.8.1): Extracting archive
- Installing guzzlehttp/promises (1.4.1): Extracting archive
- Installing guzzlehttp/guzzle (7.3.0): Extracting archive
- Installing laravel/sail (v1.4.10): Extracting archive
- Installing nikic/php-parser (v4.10.4): Extracting archive
- Installing dnoegel/php-xdg-base-dir (v0.1.1): Extracting archive
- Installing psy/psysh (v0.10.7): Extracting archive
- Installing laravel/tinker (v2.6.1): Extracting archive
- Installing hamcrest/hamcrest-php (v2.0.1): Extracting archive
- Installing mockery/mockery (1.4.3): Extracting archive
- Installing nunomaduro/collision (v5.3.0): Extracting archive
- Installing phpdocumentor/reflection-common (2.2.0): Extracting archive
- Installing phpdocumentor/type-resolver (1.4.0): Extracting archive
- Installing phpdocumentor/reflection-docblock (5.2.2): Extracting archive
- Installing sebastian/version (3.0.2): Extracting archive
- Installing sebastian/type (2.3.1): Extracting archive
- Installing sebastian/resource-operations (3.0.3): Extracting archive
- Installing sebastian/recursion-context (4.0.4): Extracting archive
- Installing sebastian/object-reflector (2.0.4): Extracting archive
- Installing sebastian/object-enumerator (4.0.4): Extracting archive
- Installing sebastian/global-state (5.0.2): Extracting archive
- Installing sebastian/exporter (4.0.3): Extracting archive
- Installing sebastian/environment (5.1.3): Extracting archive
- Installing sebastian/diff (4.0.4): Extracting archive
- Installing sebastian/comparator (4.0.6): Extracting archive
- Installing sebastian/code-unit (1.0.8): Extracting archive
- Installing sebastian/cli-parser (1.0.1): Extracting archive
- Installing phpunit/php-timer (5.0.3): Extracting archive
- Installing phpunit/php-text-template (2.0.4): Extracting archive
- Installing phpunit/php-invoker (3.1.1): Extracting archive
- Installing phpunit/php-file-iterator (3.0.5): Extracting archive
- Installing theseer/tokenizer (1.2.0): Extracting archive
- Installing sebastian/lines-of-code (1.0.3): Extracting archive
- Installing sebastian/complexity (2.0.2): Extracting archive
- Installing sebastian/code-unit-reverse-lookup (2.0.3): Extracting archive
- Installing phpunit/php-code-coverage (9.2.6): Extracting archive
- Installing doctrine/instantiator (1.4.0): Extracting archive
- Installing phpspec/prophecy (1.13.0): Extracting archive
- Installing phar-io/version (3.1.0): Extracting archive
- Installing phar-io/manifest (2.0.1): Extracting archive
- Installing myclabs/deep-copy (1.10.2): Extracting archive
- Installing phpunit/phpunit (9.5.4): Extracting archive
79 package suggestions were added by new dependencies, use `composer suggest` to see details.
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi
Discovered Package: facade/ignition
Discovered Package: fideloper/proxy
Discovered Package: fruitcake/laravel-cors
Discovered Package: laravel/sail
Discovered Package: laravel/tinker
Discovered Package: nesbot/carbon
Discovered Package: nunomaduro/collision
Package manifest generated successfully.
74 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
> @php artisan key:generate --ansi
Application key set successfully.
Application ready! Build something amazing.
Untuk instalasi menggunakan composer, gunakan perintah:
composer create-project --prefer-dist laravel/laravel blog
Dengan demikian, project baru dengan nama blog
terinstal pada direktori yang sedang aktif.
Tes Laravel
Jika proses instalasi tidak terjadi error maka laravel sudah berhasil terinstal.
Untuk melakukan tes pada project yang telah dibuat, masuk ke direktori tersebut dan jalankan php artisan serve
.
cd blog
php artisan serve
Output yang dihasilkan:
Starting Laravel development server: http://127.0.0.1:8000
[Fri Apr 2 15:25:48 2021] PHP 8.0.3 Development Server (http://127.0.0.1:8000) started
Jika statusnya sudah started
, silahkan buka browser dan arahkan ke URL http://127.0.0.1:8000
dimana 8000
adalah port yang digunakan oleh laravel.
Berikut tampilan yang berhasil dijalankan.
Tes Laravel menggunakan Direktori
Untuk menjalankan Laravel secara manual tanpa menggunakan php artisan serve
, maka project laravel harus ditempatkan terlebih dahulu pada direktori server localhost yang terinstal pada sistem. Pada umumnya berada di direktori htdocs
. Untuk OS yang saya gunakan, server localhost berada pada direktori /var/www/html
.
Contoh project saat ini yaitu surat_masuk_keluar
, sehingga direktorinya menjadi /var/www/html/surat_masuk_keluar
. Saat dijalankan, akan menampilkan error seperti berikut.
Untuk mengatasinya, folder storage
yang ada di dalam project harus diubah kepemilikannya terlebih dahulu menjadi www-data
baik user maupun group-nya. Gunakan perintah:
sudo chown -R www-data:www-data storage
Dari referensi yang digunakan, folder vendor
dilakukan hal yang sama.
sudo chown -R www-data:www-data vendor
Jika selesai dilakukan, silahkan buka browser untuk menjalankan project yang dibuat melalui localhost. Arahkan pada URL localhost/surat_masuk_keluar/public
.
Dan, berhasil!!! Selamat, project Laravel telah terinstal pada OS yang digunakan.
Demikian langkah-langkah instalasi composer dan laravel semoga langkah-langkah yang ada mudah dipahami dan diikuti. Terima kasih.