Ever had the need to load a Comma Separated Values (CSV) file in PHP? This simple code block will do it quickly.Continue reading “Simple CSV loading in PHP”
Laravel test coverage with php-code-coverage – Part 1
If you are developing a project in Laravel you are probably (should?) be using phpunit to execute tests. This tutorial will guide you through setting up a graphical representation of your test coverage so that you can see which lines of your logic are not being tested.Continue reading “Laravel test coverage with php-code-coverage – Part 1”
Testing emails in Laravel
Software testing is a key aspect of writing an high-quality code, and helps ensure that any future changes don’t unexpectedly break anything. Automation increases the repeatability of this task and is easily applied to Laravel.
Many modern web apps use email to send welcome information or notifications to users based upon certain events. Even with a well setup test environment, you will want to stop possible hundreds or thousands of test emails being sent. And there is an easy solution.
memcached for PHP sessions tutorial
Sessions are a simple mechanism for web technologies like PHP to create a unique ID for each visitor which can then be used to persist data between page requests. Upon their first visit, a cookie is dropped in the user’s browser with the generated ID which the server then uses to store data about this session until the cookie expires or is deleted.
This post explorer the use of memcached as the PHP session handler, and explains the pro’s and con’s of its use compared to the default.Continue reading “memcached for PHP sessions tutorial”
Adding columns to existing tables with Laravel
One of the powerful features of Laravel is the powerful database migration processes. It is easy to add, or delete, columns from existing tables and the artisan command does much of the boilerplate work for you.Continue reading “Adding columns to existing tables with Laravel”
Faking Carbon test dates
Carbon is one of the main datetime libraries used during Laravel development, and it provides many friendly functions for datetime manipulation and mathematics. But what if you want to test code which calls functions such as
PHP fpm process manager options explained
PHP FPM (FastCGI Process Manager) is a popular technology for processing php directives, particularly when used in conjunction with NGINX although it can be used with Apache.
In a common deployment scenario, the webserver is configured as a reverse-proxy with fpm providing the heavy lifting by processing the php code. Some of the most significant benefits of this approach are the ability to scale both up and out as your site or application grows.
Although every Linux distribution will work ‘out of the box’, there are a number of parameters which can be tuned to enhance performance.
Continue reading “PHP fpm process manager options explained”