Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Freek Van der Herten:
Zero downtime deployments with Envoy
Nov 23, 2015 @ 10:52:36

In this post to his site Freek Van der Herten shares an Envoy script that can be used to deploy an application to a remote server with (or without I suppose) one key thing: downtime.

Envoy is Laravel’s official task runner. Using a Blade style syntax tasks can be defined that can be run both locally and remotely. At Spatie, we’ve been using Envoy for quite some time to deploy code on production servers. [...] [Our trusty Envoy scriot] had a big downside: the application would be down for close to a minute. This week I took the time to solve that issue.

He talks about the changes he made to their deployment process towards using a symlink-based system as suggested by this guide. The result is an updated script that follows the same flow. He steps through the changes he made to the script and tweaks used to get the best performance out of the deploy process.

tagged: downtime deployment laravel envoy automation symlink update script

Link: https://murze.be/2015/11/zero-downtime-deployments-with-envoy/

Doctrine ORM and Laravel 5
Nov 19, 2015 @ 10:55:39

On the NetTuts site there's a tutorial posted helping you get familiar with Doctrine 2 (the ORM) and how to integrate it with a Laravel 5 application via a simple service provider.

As a PHP developer, you might have come across the term ORM. ORM is a way to work with databases in the same way you work with classes and objects. If you were to delve deeper into how web applications are designed and built, after doing some exploring in their ORM you would find two well-known patterns: Active Record and Data Mapper.

[...] With Data Mapper the in-memory objects needn’t know that there is even a database present. They need no SQL interface code or knowledge of the database schema. One such solution is Doctrine.

The tutorial walks you through some of the basic concepts in using the Doctrine 2 ORM including Entities and Repositories. Also included is how to pull it in via Composer and update your Laravel configuration to use this bridge library for integrating it into your current application. Code examples are included showing you how to build out an entity, repository and a validator class for a basic blog post.

tagged: introduction integration tutorial laravel orm doctrine2 entity repository validator

Link: http://code.tutsplus.com/tutorials/doctrine-orm-and-laravel-5--cms-24914

Laravel News Podcast:
LN 04: Fallout 4, Homestead, and more
Nov 18, 2015 @ 09:49:11

The Laravel News site has posted the latest episode of the Laravel News Podcast, hosted by Eric Barnes - Episode #4: Fallout 4, Homestead, and more.

Features of this episode include Fallout 4, Laravel Homestead, Lets Encrypt, some new Laravel packages, tutorials, and more…

Other topics mentioned include PHP Saturday and the Captain hooks package. You can listen to this latest episode either through the in-page audio player or by subscribing to the RSS and getting the latest episodes as they're released.

tagged: laravelnews laravel podcast news ep4 ericbarnes

Link: https://laravel-news.com/2015/11/ln-04-fallout-4-homestead-and-more/

Alfred Nutile:
Laravel Training: The Laravel Maven and the Laravel Novice
Nov 11, 2015 @ 11:09:22

Alfred Nutile has posted information about a series of Laravel-related training videos that aim to help you go from "Laravel 0 to Deploy" as they walk you through the creation and deployment of a simple blog based on the Laravel framework features.

The two of us come together in this raw footage of building a Blog in Laravel. You get both the insights of an experienced Laravel Software Writer (Alfred Nutile) and the questions of a WordPress developer new to Laravel, (Joe Bacal)

As of the time of this post there's four episodes in the series with more planned:

Other topics to come include working with Homestead, managing Gulp dependencies, creating a contact form and working with single page applications.

tagged: laravel training screencast introduction beginner video series blog application

Link: https://alfrednutile.info/trainings/laravel

Jon LeMaitre:
Separation of Concerns with Laravel’s Eloquent (Series)
Nov 10, 2015 @ 09:10:47

Jon LeMaitre has written up a series of posts talking about effective separation of concerns using Eloquent, the database access component of the Laravel framework. His goal is to show you how makes use of the library and keep your application both maintainable and readable.

Eloquent (and by extension, Laravel) is often criticized because of its ActiveRecord ORM implementation, and that DataMapper produces a cleaner, more maintainable architecture in the long run. [...] This combination of behaviors crammed into a single object in itself is not the problem (in fact, it’s a wonderful asset), the problem is in how you make use of those behaviors throughout your application. You can be sloppy with them, or you can be tidy with them.

He starts with the "sloppy approach" where different methods of accessing the objects (and their data) are spread all across the application. He counters this with the tidy approach that makes use of "persistence-agnostic 'POPOs'" to hide the logic behind repositories. In the second part of the series he starts in and puts this idea into practice, using a simple "Member" table and model and repository classes to abstract the logic. Finally, in part three he gets into some more extended functionality for the repositories approach: handling collections, relations, eager loading and schema changes.

tagged: laravel eloquent designpattern repository orm datamapper activerecord abstraction tutorial series

Link: https://medium.com/laravel-news/separation-of-concerns-with-laravel-s-eloquent-part-1-an-introduction-c9a6dc6b4a65#.o0qsccqos

Matt Stauffer:
Environment specific variables in Laravel's testing environment
Nov 06, 2015 @ 10:43:09

Matt Stauffer has a quick post to his site showing how you can set up and use environment specific variables in Laravel, specifically for your testing environment.

In Laravel, it's easy to set environment variables that are specific to your testing environment. Just edit your phpunit.xml file and set them as entries in the block [...] but what if you find yourself needing to exclude these values from version control?

He talks about the project he's working on and its integration with Twilio. He need to write some tests for a class that connected to the Twilio service but wanted an easy way to swap out the production credentials with the Twilio test ones. Instead of checking in the test credentials, he dropped them into his .env settings file, one specific to the test environment.

tagged: environment variable laravel testing twilio credentials.

Link: https://mattstauffer.co/blog/environment-specific-variables-in-laravels-testing-environment

SitePoint PHP Blog:
How Laravel Facades Work and How to Use Them Elsewhere
Nov 05, 2015 @ 11:55:49

The SitePoint PHP blog has a new tutorial posted showing you how Laravel Facades work and how they ("Facades") can be used in other framework types.

The Facade pattern is a software design pattern which is often used in object oriented programming. A facade is, in fact, a class wrapping a complex library to provide a simpler and more readable interface to it. The Facade pattern can also be used to provide a unified and well-designed API to a group of complex and poorly designed APIs. The Laravel framework has a feature similar to this pattern, also termed Facades. In this tutorial we will learn how to bring Laravel’s "Facades" to other frameworks.

He starts off by looking at how the Laravel framework has implemented facades through out the entire framework. He includes examples of using these facades (like the App to make a new object instance) and how the base Facade class is structured to make it work. He covers some of the basic features of the classes that extend this base and how they're aliased in the Laravel code/configuration. He then gets into using this same sort of "facade" approach to other frameworks, specifically in an app based on the Silex microframework. He lists some of the requirements and shows how to pull in the base Facade class to extend. He also integrates the aliasing code and configuration to make it simpler to use the short names rather than full namespaced versions of the classes.

tagged: laravel facade introduction tutorial silex approach naming

Link: http://www.sitepoint.com/how-laravel-facades-work-and-how-to-use-them-elsewhere/

Laravel News Podcast:
LN 03: Laravel Quickstart Tutorials
Nov 05, 2015 @ 09:10:25

The Laravel News podcast, with host Eric Barnes, has posted their latest episode today, Episode #3 - Laravel Quickstart Tutorials:

In this episode of the Laravel News Podcast, we discuss the new Laravel quick start guides, features coming to Laravel 5.2, Elixir and Bootstrap, Developer interruptions and more!

He also talks about a Laravel tagging package, forcing complex passwords in Laravel apps and an article from Ryan Winchester about forcing password requirements on users, even if it's more secure than your requirements. You can listen to this latest episode either through the in-page audio player or you can subscribe on iTunes to pull down the show and listen at your leisure.

tagged: laravel quickstart tutorial laravelnews podcast ep3 ericbarnes

Link: https://laravel-news.com/2015/11/ln-03-laravel-quickstart-tutorials/

Laravel News:
Laravel 5.2 - A Look at what’s coming
Nov 02, 2015 @ 11:06:05

The Laravel News site has posted a look ahead at Laravel 5.2, the next minor version release of the popular framework.

ravel 5.2 development is underway and so far a few nice additions have been announced. Let’s take a look at everything we know is coming to the release.

Among the things mentioned are improvements/features like:

  • Implicit model binding
  • Form Array Validation
  • Collections Wildcards
  • Database Session Driver updates

This version isn't released yet (as of the time of this post) but it's coming soon. Keep an eye on the main Laravel site for more information.

tagged: laravel minor version update enhancement feature framework

Link: https://laravel-news.com/2015/11/laravel-5-2-a-look-at-whats-coming/

Laravel News:
Laravel Intermediate Tutorial
Oct 29, 2015 @ 10:49:56

The Laravel manual was recently updated with a quickstart to help beginners to the framework learn the basic steps to creating a simple Laravel application. According to the Laravel News site they've also added an intermediate tutorial that gets a bit more in-depth with the framework and expands on the same "task list" example application.

This intermediate tutorial covers Eloquent relationships, Authentication, Dependency Injection, Route Model Binding, Authorization, and more. Both of these Laravel tutorials are fantastic resources for getting up and running with the framework.

You can find this tutorial in the Laravel manual and, if it seems like a bit much and you want a more basic level, you can check out the quickstart instead and get up and running quickly.

tagged: laravel intermediate tutorial tasklist introduction framework

Link: https://laravel-news.com/2015/10/laravel-intermediate-tutorial/