PHP, Programming




Design and Implementation of a Flexible Application Architecture

Here's a link to the talk I gave at LAPHP meetup on creating a flexible application architecture using Laravel 4. The talk was based around principles of a SOLID architecture. Then going through how it might be applied to a Laravel 4 application. Here's the talk



Array list of all timezones

I needed an array of all the timezones so I could insert it in to a database seeder. So I created one off a list from wikipedia. \$timezones = array( array('abbr'=>'BIT', 'name'=>'Baker Island Time', 'utc'=>'UTC-12'), array('abbr'=>'NUT', 'name'=>'Niue Time', 'utc …



BaseRepositoryInterface Base Eloquent Repository

Here's a base Eloquent Repository. interface BaseRepositoryInterface { /\*\* \* Execute the query and get the first result. \* \* @param array \$columns \* @return :::IlluminateDatabase:::EloquentModel|null|static \* @static \*/ public function first(\$columns); /\*\* \* Execute the query and get the first result or throw an exception. \* \* @param array \$columns \* @return :::IlluminateDatabase:::EloquentModel \* @static \*/ public function firstOrFail …



How to get laravel database prefix

I needed to get the db prefix for a raw insert query I was running. It's an easy function call to get the current database prefix. DB::getTablePrefix(); Will output the prefix for the current database. This will work in laravel 4.



How to get the base directory of a laravel 4 installation.

In order to get the base directory of a laravel 4 install you'll just need to do one command. It's fairly simple. app()->make('path.base')



Laravel 4 release date

When will Laravel 4 be released? Per Taylor's announcement at Laracon it will be released in May of 2013. Further on the wiki there is a time table for the next 4 releases. Is Laravel 4 stable enough to use in production? I would say yes. At this point in …



How to specify specific engine in Laravel 4 migration

Earlier today I needed to set up a specific database engine for a mysql table that wasn't the databases's default. In this instance, the default was INNODB and I needed it to be MyISAM. We could discuss the reasons why I shouldn't use MyISAM but in this instance that's what …



How to set Laravel 4 environments

The environment is based on url matches. You'll find that configuration in /bootstrap/start.php [ps] \$env = \$app->detectEnvironment(array( 'local' => array('your-machine-name'), )); [/ps] Now say you are developing locally and use the prefix/postfix local. E.g: my-new-site.local or local.my-new-site [ps] \$env = \$app->detectEnvironment(array( 'local' => array …



How to add a library folder to Laravel 4

I typically use a library folder in my projects to group of files that you want to use in different projects but don't want to use Satis to manage the contained files. This folder could also be a helper folder for functions that are static and are mainly generic helpers …