Eric L. Barnes

Laravel Log Viewer

A simple Laravel bundle to display your log files via the browser.

Installation

php artisan bundle:install logviewer

Publish assets

php artisan bundle:publish logviewer

Then edit your application/bundles.php file and add:

return array(
    'logviewer' => array(
        'location' => 'logviewer',
        'handles' => 'logviewer'
    )
);

Download

You can clone the repo by running the code below:

$ git clone git://github.com/ericbarnes/Laravel-Log-Viewer

Or visit the GitHub Repo.

New Laravel Bundle App

Since starting at UserScape I have been tasked with building a new bundle application for the Laravel framework. So far all the work has been done “behind the scenes” but I wanted to share a few screenshots of what I have completed so far.

Home Page

This is a temporary home page which showcases the latest and the most popular. Currently the most popular will be determined by number of installs but I have some ideas for better stats and filtering that will come later.

Bundle Grid

This is the grid list. I tried keeping it simple so you can quickly scan the titles and also show each users gravatar for branding.

I am really happy with what I have completed so far and it should be a simple and effective way for users of the framework to find pre-built code to put in their applications.

If you are interested in seeing how to create a bundle check out Taylor’s Videos

A nice and simple flat file markdown based blog application built by Ian Landsman for use on his site. The description says:

I built this to run ianlandsman.com over a weekend :) It may not work for you. I’m posting it up in case anyone else may find it useful. It might also be useful to those interested in working with the PHP Laravel framework.

Although he states it isn’t complete yet from my tests it works like it supposed to but still missing a few small features. I like the setup and the use of the command line to publish the posts and clear the cache.

CodeIgniter Output Caching

This week I had the privilege of doing load testing on an aws setup. The goal of the test was to support 25k concurrent users and was designed to ramp up over a period of a few minutes. The first round of testing failed pretty quick and I only had a select number of large queries cached. So the db spiked and was the bottle neck. During that test we was only able to reach 10k concurrents.

For the second round of testing I decided to just setup output caching before I even loaded the db in a MY_Controller. I set the number of minutes to something relatively high and was ready to commence the load test. Unfortunately this test maxed out the db again and I was honestly scratching my head on just why that would be the case.

Since this didn’t make any sense to me I decided I better figure just what is going on. I got my local system setup the exact same way, enabled mysql query log, and then proceded to test and see what was going on. Queries was being ran even after the cache file was written. At this point it was way late so I decided I better sleep on it and try and think about what I was missing.

The next morning I got to work ran the same tests and got the same results. Starting researching and then realized it was just my ajax calls that was generating the queries. This had me puzzled because the ajax controller extended the MY_Controller so it should be cached as well. Turns out I was wrong and missed the most important note in the user guide:

Warning: Because of the way CodeIgniter stores content for output, caching will only work if you are generating display for your controller with a view.

The more I thought about it the more sense that makes since the Loader ties into the output library but I wasn’t thinking clearly at 3am. Looked at my ajax controller and sure enough I was just returning a json string.

return json_encode($vars);

The quick fix was to change the return to the following:

return $this->output->set_output(json_encode($vars));

My hope is this will help others if they ever run into the same situation. Unfortunately the load testing was only scheduled for two rounds but I feel confident by fixing that it would have passed with flying colors.

So the moral of the story. READ THE MANUAL :-)

New Year, New Job, New Framework

I am happy to announce that starting January 9th I will be working full time for Userscape. If you are not familiar with them they are the company behind the awesome HelpSpot help desk software.

Laravel

Not only will I be a part of a great company but they have also hired the creator of the Laravel framework, Taylor Otwell. I have been watching that framework closely the past few months and I am very impressed with what he has done with it. Laravel’s motto is:

Laravel is a clean and classy framework for PHP web development. Freeing you from spaghetti code, Laravel helps you create wonderful applications using simple, expressive syntax. Development should be a creative experience that you enjoy, not something that is painful. Enjoy the fresh air.

The simplicity of framework is what drew me in originally. But now it will just keep getting better and better because it will be the framework of choice for Userscape. The reason I feel this way is that HelpSpot can be purchased as either a downloaded application or hosted with their partner Engine Hosting, so Laravel will be tested in a wide range of different hosting environments.

CodeIgniter

Even though my day job will be with Laravel I still love CodeIgniter and I am still on the CodeIgniter Reactor team. CodeIgniter is and has always been near and dear to me and I really enjoy using it. Plus I will be doing contract and freelance work for companies that are heavily invested into it. I am very excited with where CodeIgniter v3 is heading and I think it is a big step in the right direction that we have all been wanting.