Clean Code SOLID principles applied to PHP

clean-code-php is an excellent set of examples for the SOLID principles as applied to PHP programming:

Software engineering principles, from Robert C. Martin’s book Clean Code, adapted for PHP. This is not a style guide. It’s a guide to producing readable, reusable, and refactorable software in PHP.

Not every principle herein has to be strictly followed, and even fewer will be universally agreed upon. These are guidelines and nothing more, but they are ones codified over many years of collective experience by the authors of Clean Code.

Inspired from clean-code-javascript

TNTSearch – a fully featured full text search engine written in PHP

TNTSearch – a fully featured full text search engine written in PHP.  Here’s also a blog post that shows how to use it with the Laravel framework.  Which shouldn’t be too difficult to adjust for any other PHP framework.

Integrated Package for better testing in CakePHP

Viraj Khatavkar wrote this blog post showing how to use Integrated Package for better testing in CakePHP.  Testing in general is not a simple subject, so anything to assist with it is very very welcome.

I’m sure we’ll be trying it at work in the next week or two.

Using php-fpm as a simple built-in async queue

Here’s an interesting solution for a poor man’s asynchronous queue using PHP-FPM:

PHP-FPM already acts as a queue for Nginx/Apache FastCGI clients. While your web-request is running you can just send another FastCGI request to the same PHP-FPM socket asynchronously and non-blocking. This request is immediately executed in another php-fpm process in parallel and you could wait for it to complete or just fire and forget.

Given the experimental nature of this approach, you probably won’t be running this in production.  And with many developers switching to the built-in PHP web server for the local development, this doesn’t work for those environments other.

But it makes me think what else can be used as a queuing mechanism.  After all, there are plenty of systems that rely on this already – email servers, printer spoolers, web and proxy servers, and probably more.

Scheduled pipelines now available in Bitbucket Pipelines

BitBucket blog announces the support for scheduled Bitbucket Pipelines.  This is super cool and has been on the wishlist for a while now.  Here are a few examples of how this feature is useful:

  • Nightly builds that take longer to run
  • Daily or weekly deployments to a test environment
  • Data validation and backups
  • Load tests and tracking performance over time
  • Jobs and tasks that aren’t coupled to code changes