Why I’m moving from Coldfusion to PHP

People have spent a lot of time both predicting the death of Coldfusion, as well as refuting that assertion. Of course, it’s not really “dying”. It’s still very popular in government and higher education (I don’t have any stats to back this up, but this is what I’ve observed). Everywhere else, however, it’s market share appears to be small compared to PHP, Rails, etc. I blame Macromedia/Adobe for not providing a free, open-source version and for not marketing it sufficiently. Railo has filled the open-source hole, but it’s too little, too late.

Laravel 4 Pagination with Column Sorting

Updated (4/24/2014) to address possible SQL injection attempt with $order and/or $sort input.

It took a little effort, but I finally got Laravel 4′s pagination class working with the ability to sort by column. Posted here so I don’t forget.

//Controller 
$widgets = Widget::all(); 
$allowed_columns = ['column1', 'column2', 'column3']; 
$sort = in_array(Input::get('sort'), $allowed_columns) ? Input::get('sort') : 'delivery_date'; 
$order = Input::get('order') === 'asc' ? 'asc' : 'desc'; 
$widgets = $widgets->orderBy($sort, $order); 
$widgets = $widgets->paginate(20); 

//include $order and $sort when retrieving your layout/view 
$this->layout->nest('content', 'widgets.index',array( 'widgets' => $widgets, 'sort' => $sort, 'order' => $order) ); 

//View 
//Display the pagination 
//I tried using appends() first, but could not chain multiples 

{{ $events->addQuery('order',$order)->addQuery('sort', $sort)->links() }} 

//Column header 
//Using Twitter Boostrap up/down arrows
<th>Status
    <a href="{{action('[email protected]', array('sort' => 'status', 'order' => 'asc'))}}">
        <i class="fa fa-chevron-up"></i>
    </a>
    <a href="{{action('[email protected]', array('sort' => 'status', 'order' => 'desc'))}}">
        <i class="fa fa-chevron-down"></i>
    </a>
</th>

 

 

A few Laravel 4.1 Update Gotchas

Update (12/12/1013)

One of the headaches with the upgrade to Production was waiting for ‘composer update’ to run while the site was down due to the skeleton and framework being out of sync. However, I’ve just realized that I should be pushing my composer.lock file to prod and just running ‘composer install’, which is much faster and makes sure your packages are in sync across environments. Doh!*

Simple PHP class for sending Slack messages

There are some nice PHP packages for integrating SlackHQ, including some specifically for Laravel. However, most of these do a lot of stuff I don’t really need right now. I just needed something simple to send a message to Slack when certain events take place in my app.

Resolving Issues with Laravel Remote SSH Keys

I was recently banging my head over getting SSH keys to work with Laravel’s Remote Component. I’m apparently not alone in having problems getting this to work. I set up my remote connection as expected, pointing to my SSH private key file:

'production' => array( 
    'host' => 'xxx', 
    'username' => getenv('SSH_USER'), 
    'password' => '', 
    'key' => '/Users/gtaylor/.ssh/id_rsa', 
    'keyphrase' => '', 'root' => '/var/www', 
    ),