Designinglives

27/12/14 composer , laravel 5 , packages , packagist

Install new dependencies

If you would like to install dependencies in laravel there are 2 ways to do so, you can either open up your composer.json file and edit it to put in the dependencies you would like to include inside your project. This is an example of what can be found inside my composer.json file:

"require": {
	"laravel/framework": "4.2.*"
},
"require-dev": {
	"way/generators": "~3.0",
	"codeception/codeception": "~2.0"
}

Continue reading

0 likes no responses
16/11/14 installation , laravel 5

Installing latest Laravel (development) release

I’ve been experimenting with Laravel 5.x lately to get up to speed with the latest stuff being released. This is how to start a new project with the latest development version:

composer create-project laravel/laravel app-name dev-develop
0 likes no responses
16/11/14 blade , laravel 5 , templates

Laravel Blade templates

If you have never worked with a templating engine it’s about time you open the door to let a breeze run through your projects! I’m sure you will be amazed about how easy Blade will be to use as well as how clean your templates will look. Sharpen your Blades, here we go!

This is what my controller function would look like, it’s called from the routes file and will make sure our application has maximum flexibility.

public function view() {
    $data['title'] = 'Titel pagina';
    $data['subtitle'] = 'Subtitel pagina';
    $data['random'] = rand(1,3);
    $data['loop'] = ['<em>Item 1</em>', '<i>Item 2</i>', '<b>Item 3</b>'];
    $data['users'] = [];
		
    return view('pages.example', $data);
}

Continue reading

0 likes no responses
14/11/14 error , laravel 5

Custom ‘Not found HTTP exception’

When you start doing routing and add some rules, in the beginning it’s easy to make a lot of mistakes. Because I didn’t want others to see the output laravel throws on the screen I decided to start looking for a solution to add custom error pages. In Laravel 5 you can get this done by going into app- Http - Kernel.php.

Here you should add the following to make sure the right class is called and a Response object can be made.

use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Response;

Continue reading

0 likes no responses
14/11/14 error , homestead , laravel 5 , vagrant

Vagrant timeouts

Ever since I upgraded my virtualbox I was having issues with vagrant when I returned from standby. The pages I was trying to load kept going until they gave me a gateway timeout.

The following command seems to solve the virtualbox issue and will ensure your vagrant box will be running better then ever after a return from standby!

sudo launchctl load /Library/LaunchDaemons/org.virtualbox.startup.plist

Continue reading

0 likes no responses
14/11/14 laravel 5 , routing

Laravel routing

Most, if not all, routing will be done inside the app/routes.php file. Here you’ll already find a very basic example which will be called to view the first template, I’ve extended mine with a few others to experiment a bit.

$router->get('/about', 'PagesController@about');

Continue reading

0 likes no responses
11/11/14 error , installation , laravel 5

Mcrypt PHP extension required

During my Laravel install I had some issues using the terminal, they all turned out to be linked to one issue:

Mcrypt PHP extension required

To solve this we need to open the bashrc file again which we also used during our install. Add the following line at the bottom of the script, this will ensure the use of AMPPS php, you can also use the MAMP path if wanted. Save the file (ctrl+x) and make sure the file is loaded again.

nano ~/.bashrc
export PATH="/Applications/AMPPS/php/bin:$PATH"
source ~/.bashrc

Continue reading

0 likes no responses
10/11/14 installation , laravel 5

Installing laravel

I’ve read quite a few articles about bringing me up to speed. The following commands will allow you to install laravel globally on your machine.

composer global require "laravel/installer=~1.1"

Continue reading

0 likes no responses