Blog Emka

Portal tutorial linux, pemrograman sistem informasi, computer security & informasi santri Indonesia

Tutorial Laravel

Tutorial Laravel (2): Instalasi Laravel

Laravel merekomendasikan instalasi Laravel dengan menggunakan Composer. Composer sendiri adalah tool berbasis PHP yang dipergunakan sebagai dependency manager bagi sebuah aplikasi/library, seperti Apt-get, Yum, atau Zypper di Linux.

Berikut adalah langkah-langkah menginstall Laravel 4 dengan Composer:

iklan Laravel

1. Unduh Composer

Composer, dapat anda download dari situs http://getcomposer.org. Disediakan dua versi, versi Installer Windows dan versi script PHP (untuk Linux dan Mac). Untuk lebih mudahnya, silakan download Installer Composer (berupa script PHP) disini:

https://getcomposer.org/installer

Klik kanan dan save-as installer.php (atau jika mengunduh dari link diatas, silakan unzip/unrar).

2. Install Composer

Buka Terminal/Console atau Command Prompt Windows, dan jalankan installer dengan PHP-CLI:

php installer.php

atau jika anda menggunakan XAMPP:

C:/xampp/php/bin/php installer.php

atau

/opt/lampp/bin/php installer.php

NB. Anda butuh koneksi Internet saat menjalankan installer, karena installer akan mengunduh sejumlah file!

Contoh pesan installasi Composer via terminal:

All settings correct for using Composer
Downloading...

Composer successfully installed to: /Users/unnes/Sites/composer.phar
Use it: php composer.phar

3. Rename Composer.phar menjadi Composer

4. Instalasi Laravel
ada dua metode instalasi laravel dengan Composer.

a. dengan menggunakan Composer secara langsung

Jalankan perintah:

php composer create-project laravel/laravel nama-project --prefer-dist

dengan perintah diatas, composer akan membuat project baru berbasis Laravel dengan nama yang ditentukan. Contoh pesan dalam terminal:

Installing laravel/laravel (v4.0.7)
  - Installing laravel/laravel (v4.0.7)
    Downloading: 100%

Created project in your-project-name
Loading composer repositories with package information
Installing dependencies (including require-dev)
  - Installing doctrine/lexer (dev-master bc0e1f0)
    Loading from cache

  - Installing doctrine/annotations (v1.1.2)
    Loading from cache

  - Installing doctrine/collections (dev-master bcb5377)
    Loading from cache

  - Installing doctrine/cache (v1.1)
    Loading from cache

  - Installing doctrine/inflector (dev-master 8b4b3cc)
    Loading from cache

  - Installing doctrine/common (dev-master 4233262)
    Downloading: 100%

  - Installing doctrine/dbal (2.4.x-dev 814e53d)
    Loading from cache

  - Installing psr/log (1.0.0)
    Loading from cache

  - Installing monolog/monolog (dev-master 1518320)
    Loading from cache

  - Installing filp/whoops (1.0.7)
    Loading from cache

  - Installing symfony/translation (2.3.x-dev 65f8882)
    Loading from cache

  - Installing symfony/routing (2.3.x-dev 3085975)
    Loading from cache

  - Installing symfony/process (2.3.x-dev ca5703f)
    Downloading: 100%

  - Installing symfony/debug (2.3.x-dev 234f31c)
    Downloading: 100%

  - Installing symfony/http-foundation (2.3.x-dev 329b059)
    Downloading: 100%

  - Installing symfony/event-dispatcher (2.3.x-dev 41c9826)
    Loading from cache

  - Installing symfony/http-kernel (2.3.x-dev f42c094)
    Downloading: 100%

  - Installing symfony/finder (2.3.x-dev 4a0fee5)
    Loading from cache

  - Installing symfony/dom-crawler (2.3.x-dev e05e07f)
    Loading from cache

  - Installing symfony/css-selector (2.3.x-dev 8855442)
    Loading from cache

  - Installing symfony/console (2.3.x-dev 7a8f90c)
    Downloading: 100%

  - Installing symfony/browser-kit (2.3.x-dev 11dcdf2)
    Loading from cache

  - Installing swiftmailer/swiftmailer (v5.0.2)
    Loading from cache

  - Installing predis/predis (0.8.x-dev 4824af1)
    Loading from cache

  - Installing patchwork/utf8 (v1.1.11)
    Loading from cache

  - Installing nesbot/carbon (1.4.0)
    Loading from cache

  - Installing ircmaxell/password-compat (1.0.x-dev 1fc1521)
    Loading from cache

  - Installing nikic/php-parser (dev-master 1e5e280)
    Loading from cache

  - Installing symfony/filesystem (dev-master da0dcf6)
    Loading from cache

  - Installing classpreloader/classpreloader (1.0.1)
    Loading from cache

  - Installing laravel/framework (4.0.x-dev 733492c)
    Downloading: 100%

monolog/monolog suggests installing mlehner/gelf-php (Allow sending log messages to a GrayLog2 server)
monolog/monolog suggests installing ext-amqp (Allow sending log messages to an AMQP server (1.0+ required))
monolog/monolog suggests installing ext-mongo (Allow sending log messages to a MongoDB server)
monolog/monolog suggests installing doctrine/couchdb (Allow sending log messages to a CouchDB server)
monolog/monolog suggests installing raven/raven (Allow sending log messages to a Sentry server)
symfony/translation suggests installing symfony/config ()
symfony/translation suggests installing symfony/yaml ()
symfony/routing suggests installing symfony/config ()
symfony/routing suggests installing symfony/yaml ()
symfony/debug suggests installing symfony/class-loader ()
symfony/event-dispatcher suggests installing symfony/dependency-injection ()
symfony/http-kernel suggests installing symfony/class-loader ()
symfony/http-kernel suggests installing symfony/config ()
symfony/http-kernel suggests installing symfony/dependency-injection ()
predis/predis suggests installing ext-phpiredis (Allows faster serialization and deserialization of the Redis protocol)
Writing lock file
Generating autoload files
Generating optimized class loader
Application key [QdB6JtdmVDPsBdxd5ePWlrMzcpsqiESs] set successfully.

b. dengan mengunduh langsung dari Github dan eksekusi Composer
– Unduh file ZIP dari master sourcecode Laravel di Github.com:
https://github.com/laravel/laravel/archive/master.zip

– Unzip file master.zip, misal menjadi folder laravel
– jalankan terminal/console/command prompt, masuk ke direktori laravel
– copy file composer ke direktori laravel
– jalankan composer, dengan perintah:

composer install

Testing

Silakan test instalasi Laravel anda dengan mengakses: http://localhost/your-project-name (sesuaikan dengan nama proyek anda).

Jika sukses, seharusnya anda menemui tampilan seperti ini:

laravel-test

Jika anda menemui tampilan error seperti ini:
laravel-test-error

Silakan ubah permission folder /your-project-name/app/storage/session menjadi writable, misalnya 777.

chmod 777 /your-project-name/app/storage/session

iklan Laravel

Selamat berjumpa di seri tutorial Laravel selanjutnya!

2 Comments

  1. aiemb

    Gan mau tanya .. kalau habis instal laravel itu lngkah slanjutnya gmn yaa ..
    mau buat project tugs akhr PPDB online ni,, #msih newbie sm laravel, mohon pencerahannya ,, makasih 🙂

Leave a Reply

Theme by Anders Norén

%d bloggers like this: