Custom pagination in Laravel 4

The default Laravel pagination is built for Twitter Bootstrap 2.0 and I believe that it will be updated to use Twitter Bootstrap 3.0 in Laravel 4.1 (not sure though). So what happens when you want to use the pagination but have to customize it to your needs? It’s actually really simple since Laravel allows you to specify your own pagination view where you can access the pagination object.

Continue reading »

Get raw POST data in Laravel

I recently stumbled upon an interesting problem when trying to retrieve the raw POST body in Laravel. This happened when I was sending POST/PUT requests from AngularJS to a REST API that was built with Laravel. I did a lot of trial and error before I figured out the problem.

Continue reading »

NPath complexity and cyclomatic complexity explained

If you happen to be using PHP Mess Detector (which you should for any larger project) you have probably stumbled upon these two, but do you really know what they stand for? NPath complexity and cyclomatic complexity sounds really scary, but they are fancy words for quite simple concepts. So let’s go through them and also find out why they’re important for maintainable and testable code. Both of these concepts are used in static code analysis and are measurements of how complex a function is.

Continue reading »

Book recommendations for developers

To me it’s essential as a developer to read books, and not just looking things up on the internet. The depth of a book can not be compared to almost anything you find on the web. Keeping your knowledge fresh is important and I tend to try to read my books as often as I feel like it and have the time. What you learn by reading a book once is nothing compared to reading it perhaps two or more times. I’ll share with you a selection of books I have, mostly in my Kindle or Leanpub library, which I’ve found to help me a lot. Some of the books are not PHP specific, but are for developers in general or about software development as a concept. Some of the books are a lot about code while others are more about getting you to think about what you’re doing and how you can improve it.

Continue reading »

Laravel & Jenkins: Continuous integration

I have published an updated version of this post since this one is a bit outdated. The new post deals with PHP applications in general, and can easily be applied for continuous integration with Laravel Jenkins. Read it instead.

This will be a hands on guide for setting up automated builds for a Laravel application using Jenkins. Pretty much that when you do a commit, Jenkins will automagically make a build and in that check code errors and syntax, run unit tests and provide visual code coverage for your code base. Achieve continous integration for PHP with Laravel & Jenkins, along with other goodies.

Continue reading »