uncategorized

Start with Laravel

This is a quick start helloWorld demo of Laravel.

1. Install Composer

1
2
3
4
5
6
# Install composer
curl -sS https://getcomposer.org/installer | php

# Move composer to system library folder, so
# that we can use composer as a quick demand
mv composer.phar /usr/local/bin/composer

2. Install Laravel & Create our HelloWorld Demo

1
composer create-project laravel/laravel helloWorld

3. Change permission of app/storage folder

1
chmod -R 777 app/storage

4. Change vhost to make public folder as root directory

1
2
3
4
# Open /etc/apache2/sites-available/000-default.conf
# append public to DocumentRoot
# (Note: I already mv content from helloWorld folder to html folder)
DocumentRoot /var/www/html/public

Now, we can access the website with http://YourIPAddress now.

5. Enable mod rewrite

1
2
3
4
5
6
# Open /etc/apache2/apache2.conf
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride all #Change None to all here
Require all granted
</Directory>

6. Test for mod rewrite

1
2
3
4
# Add below function to router.php
Route::get('users', function() {
return 'Users!';
});

Now open http://YourIPAddress/users, then you can see Users! in the web page.

All Set Now!