Christian WeiskePEAR 1.10.0dev1 brings PHP 7 compatibility! (25.7.2015, 11:50 UTC)

The new PEAR installer release adds PHP 7 support while dropping support for PHP 4 - 5.3. It also fixes a nasty SSL issue that made it hard to use on PHP 5.6. With the update, strict warnings about static calls to a non-static PEAR::isError() are a thing of the past.

I've just published the first preview version: PEAR 1.10.0dev1.

You can upgrade your existing PEAR version with the following command:

$ pear upgrade PEAR-1.10.0dev1

Pre-release versions of go-pear.phar and install-pear-nozlib.phar can be temporarily be found at

Please report any bugs you find on the PEAR bug tracker or on the pear-dev mailing list.

I'm looking for a new job. If you can recommend a company in Leipzig/Germany that's looking for a PHP developer, please drop me a mail.

Simon HolywellSQL style guide (24.7.2015, 11:37 UTC)

When you’re working in a team you need ways to easily share and denote good style and taste. This is true of your primary programming language with PEP8 for Python and PSRs 1 & 2 for PHP being well known. There is probably even a style guide for HTML and CSS set out at your company. So why should SQL miss out on the party?

I have written a style guide for SQL to promote a consistent code style ensuring legible and maintainable projects -

SELECT a.title, a.release_date
  FROM albums AS a
 WHERE a.title = 'Charcoal Lane'
    OR a.title = 'The New Danger';

There are so many variant SQL styles that projects and people use which can make code difficult to easily read. Looking over various questions on Stackoverflow (on of which was mine!) I noticed that there were elements of good style that were shared by most examples.

I figured it was time that SQL had a concise and easy to read style guide that could easily be adopted and/or modified for bespoke requirements.

It is trivial to apply this style to your projects now or going forward. In the case of PHP you could have some code like the following.

$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT);
$db = new PDO(
$statement = $db->prepare("
SELECT r.last_name,
       (SELECT MAX(YEAR(championship_date))
          FROM champions AS c
         WHERE c.last_name = r.last_name
           AND c.confirmed = 'Y') AS last_championship_year
  FROM riders AS r
 WHERE r.last_name IN
       (SELECT c.last_name
          FROM champions AS c
         WHERE YEAR(championship_date) > :year
           AND c.confirmed = 'Y');
$statement->bindParam(':year', $year, PDO::PARAM_INT)
$rows = $statement->fetchAll(PDO::FETCH_ASSOC);

To produce the guide I settled upon using GitHub Pages, Jekyll and Markdown sources. This means it is very easy to make forks, open issues and pull requests as GitHub Pages will handle the hosting and site build process. It is released under the Creative Commons Attribution-ShareAlike 4.0 International License.

The style in this guide is explicitly designed to be compatible with Joe Celko’s book SQL Programming Style so that teams who have already read that book will find the guide easy to adopt.

To read the guide you can simply visit and to access the sources you can find the repository on GitHub.

If you like the guide please consider sharing it with your team and via twitter - thanks!

Lorna MitchellTest Your PHP Application on PHP 7 (24.7.2015, 10:52 UTC)

PHP 7 is coming, which is nice, but what does it mean for the majority of PHP developers? PHP as a community is notoriously slow in adoption, some of us are still waiting for 2012's new shiny to be available as standard on our hosting platforms. However with the performance benefits and a few really nice new features, PHP 7 is well worth everyone's attention, and it's actually quite easy to get started so here's my quick howto.

Get A PHP 7 Platform

These examples use Rasmus' php7dev box because it's self-contained so it won't affect any other part of your setup, and because it's super-simple to get started with on any platform. It's a vagrant box running Debian 8 and with a really easy way of switching PHP versions, including 7. Multiple PHP versions is super handy because then you can very easily check if your PHP 7 bug really is a PHP 7 bug or if it was there on PHP 5.6 as well.

To get a new project set up you need to make the files available in the PHP 7 VM, and set up an nginx server block (equivalent of a virtual host) to point to it. If your project needs storage behind it, you can either connect to those on your host machine, or the VM has MySQL and PostgreSQL already installed.

Mount Your Project As A Shared Folder

Do this step before booting the virtual machine (or just vagrant halt). Add a line to Vagrantfile to tell the VM to share another folder:

    config.vm.synced_folder "/home/lorna/projects/joindin", "/vagrant/joindin"

I added mine immediately before the end at the bottom of the file - the first directory path is where it is on my laptop, and the second is where it will be in the VM. Now when you vagrant up and SSH in (vagrant ssh from the same directory as the Vagrantfile), you should see your directory is there with the files present.

Configure Nginx

While I mostly use Apache with mod_php, this box defaults to using nginx and it's easy to set up even if you haven't used it before. All we need to do is create a new file in /etc/nginx/conf.d, and add something like (there's a lot of this, I obviously copy/pasted the starting point from somewhere but I'm pretty sure it has everything that most applications need so try it):

server {
    listen       80;
    server_name  api.joindin.php7;
    root   /vagrant/joindin/joindin-api/src/public;
    index  index.php;
    access_log  /var/log/nginx/default-access.log  main;
    error_log   /var/log/nginx/default-error.log;

    error_page   500 502 503 504  /50x.html;

    location = /50x.html {
        root   /var/www/default;

    location / {
        try_files $uri $uri/ @rewrite;
    location @rewrite {
        rewrite ^(.*)$ /index.php;

    location ~ \.php {
        include                  fastcgi_params;
        fastcgi_keep_conn on;
        fastcgi_index            index.php;
        fastcgi_split_path_info  ^(.+\.php)(/.+)$;
        fastcgi_param PATH_INFO $fastcgi_path_info;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_intercept_errors on;
        fastcgi_pass unix:/var/run/php-fpm.sock;

Edit your server_name and root settings as appropriate, then restart nginx with:

sudo service nginx restart

At this point, the VM is ready but our host machine (in this case my laptop) doesn't know where to send the traffic.

Set Up Your Host File

The VM will by default have an IP address of and hopefully you know where your hosts file is. I'm on Ubuntu so mine is /etc/hosts and I just need to add one line to it: api.joindin.php7

You should now be able to hit your chosen hostname from your browser and see your PHP application working (or not). Error logs are in /var/log/nginx, and as I say, it's worth switching back to PHP5.6 (by running newphp 56 - then you want newphp 7 to switch back later) to check if the problem is actually PHP 7 or if you set something else up wrong.

If you have test suites, please run them, and put your application through its paces. Any bugs you find, try to narrow down the replication case and report them to the appropriate place - this might be your team, but could just as easily be a library, a framework, or PHP itself. The only way to get PHP and its ecosystem as good as it can be before it goes stable is for all of us to do with it before release all the things we'll want to do after!

Getting Going With PHP 7

Hopefully this gave you a quick-start on a very easy pla

Truncated by Planet PHP, read more at the original (another 1054 bytes)

Remi ColletNew "remi-php70" repository (24.7.2015, 05:52 UTC)

I've just open the remi-php70 repository for Fedora ≥ 21 and Enterprise Linux ≥ 6.

Current version is PHP 7.0.0beta2 with about 25 extensions which are already compatible.

emblem-important-4-24.pngThis repository provides developement versions which are not suitable for production usage.

The repository configuration is provided by the latest version of the remi-release package:

  • remi-release-21-2.fc21.remi
  • remi-release-22-2.fc22.remi
  • remi-release-6.5-2.el6.remi
  • remi-release-7.1-2.el7.remi

emblem-notice-24.pngAs for other remi's repositories, it is disabled by default, so the update is an administrator choice.

E.g. to update the PHP system version:

yum --enablerepo=remi update remi-release
yum --enablerepo=remi-php70 update php\*

emblem-important-2-24.pngAs lot of extensions are not yet available, the update may fail, in this case you have to remove not yet compatible extensions, or wait for their update.

I don't plan to open this repository for EL-5 which is near to end of life.

PHP 7.0 as Software Collection stay in "remi-test" (before the switch to "remi") as there is no conflicts with the base packages.

Nomad PHPData Structures in PHP (24.7.2015, 05:00 UTC)

October - US 2015
Presented By

Matthew Turland
October 22, 2015
20:00 CDT

The post Data Structures in PHP appeared first on Nomad PHP.

Piotr PasichContinuous Deployment environment with Docker, AWS EB and Codeship (24.7.2015, 03:00 UTC)
dark happy cartoon whale 1920 wallpaperPart I – Setting up environment with Docker I have spent a lot of time watching presentations about automated deployment with Ansible, Capifony, Capistrano or making consistent environments with Vagrant or VirtualBox, but all of those presentations did not tought me how to build environment from scratch, to achieve complete continuous delivery system. And that’s […]
nick halsteadWhy programmers can make great CEOs (23.7.2015, 13:19 UTC)

The popular (mis) perception of programmers is that they spend all of their time in darkened rooms, working with millions of lines of code, and perhaps aren’t always blessed with great people skills. Yes, I come from a programming background, so I may be a little biased, but that’s plainly nonsense.

Not only are programmers capable of amazing things, creating the building blocks of modern life and business, but they are also comprised of a varied and broad demographic. Many programmers are more than capable of going on to run a business too. Yes, making the journey from programmer to CEO can be scary and in some cases it’s a major transition. But anyone doing so would be in the best company. Bill Gates, Mark Zukerberg, Marissa Mayer and James Dyson have all made the leap having started out as programmers, and you’d have to admit that they have done alright!

From business development to analysing spreadsheets, naming things and solving problems, programmers have many transferable skills that can make them the ideal CEO for a company. These are the most important.

A vision for technology
Founders of a business can be technical – that’s acceptable in business. CEOs may also bring on a co-founder with a technical background; again, there’s not generally a problem with that. But it’s when the CEO themselves has a technical background that people start to question them, and for me, it’s hard to see why that should be the case.

Programmers have a vision of the technology they work with and have helped create, and they have a strong idea of how to drive that forward. Without that vision and drive, or in the hands of someone else, not only can the technology deviate from the path it was on, the business can easily begin to stagnate. Who other than the CEO should be the person driving a business forward in this way?

One of the most important attributes required to become a CEO that programmers may find hardest to adjust to is the ability to tell a good story. Storytelling is of the highest importance in business. Right from the off, surrounding yourself with talented people is vital, and to get the best people you need to convince them, which means spinning a yarn or telling a story.

This will continue as your business develops and grows. Next up might be a bank manager and then if your company is ready to launch, you’ll be meeting press so your storytelling needs to crank up a notch further. If you then reach the stage where you require investment, angel investors especially will fundamentally invest in the person rather than the business, so that person needs to show them passion, understanding and commitment, all of which comes through good storytelling.

This goes on and on. When in the process of securing DataSift’s Series C funding, I’d been told that the key to success is all about the numbers. This is partially true but I’d suggest that bad storytelling can reduce funding by 20% and a good story may increase it by 20%. If you are dealing with a funding round of £20 million, that’s a major difference. As with anything, it’s all about practice. Do it as many times as you need, and learn to convince people with your story-telling.

Programmers can do business
One of the major misconceptions is that programmers don’t ‘do’ business, a myth perpetuated by business programmes on TV like Dragon’s Den and The Apprentice. Business development for example, is an area where programmers initially probably don’t have much exposure to, but it is also an area where they can add real value.

Bringing a high level of technical expertise into such a meeting adds real weight to a pitch. It can play a significant part in convincing people that it’s not just a sales team there to seal the deal, and that you really do know what you’re talking about.

Another aspect of business for programmers to get to grips with, is the use of Excel. By far and away the most common place to put data and probably the most-used tool in many businesses, Excel is not a popular product with programmers as a rule. However, learning to use Excel – it’s very easy – will be invaluable to the programmer turned CEO. People want revenue projections on a business at almost every stage and want to see data represented in a form that is easy to understand. Excel is the way to do this.

The name is…problem solver extraordinaire
Programmers can be highly creative when it comes to naming products and services. They have to name different bits of code all of the time, so consistently and clearly naming elements of a business (internally and externally) should be straightforward. Names that show a clear picture of what a business actually does are crucial and who better to do this than the people that helped build the technology behind it.


Truncated by Planet PHP, read more at the original (another 2439 bytes)

Matthias NobackMeeting the Broadway team - talking DDD, CQRS and event sourcing (23.7.2015, 08:27 UTC)

Visiting Qandidate in Rotterdam

Last Thursday I had the honor of meeting (part of the) Broadway team: three very smart developers working for Qandidate in central Rotterdam: Gediminas Šedbaras, Willem-Jan Zijderveld and Fritsjan. A short walk from the train station brought me to their office, where we talked about CQRS, event sourcing and some of the practical aspects of using the Broadway framework.

As you may have read I've been experimenting with Broadway extensively during these last weeks. Knowing a lot about the theory behind it, it was really nice to see how everything worked so smoothly. I had some questions however, which have now been answered (thank you guys for taking the time to do this!).


For example I wanted to know about snapshotting and what they thought of it. As I saw in the list of open issues for Broadway, some people are interested in this. When you're doing event sourcing, before an aggregate can undergo any changes, it needs to be reconstituted based on previous events that are all stored in the event store. When the event store contains many, many events for a given aggregate, this process can become too slow for use in a production environment. Snapshotting solves the issue by storing the current state of an aggregate and only replaying events that occurred later than the time of the snapshot.

At Qandidate they didn't experience this problem in a production application yet. They do feel that snapshotting is the proper solution for a real problem. Before resorting to it (because it may complicate maintenance a bit, see the section "Correcting mistakes" below), you should reconsider your design first. When your aggregates undergo so many changes that the need for snapshotting arises, you might have another problem. Possibly, an important concept is missing from your domain model (this is what DDD people like to say a lot ;)). Or you may be solving a "read" issue on the "write" side of your application. Anyway, in some cases the need for snapshotting is "legitimate" so Broadway will probably provide an off-the-shelf solution for snapshotting at some point (there is an open issue discussing this feature).

Open source vs company work

This brought me to the question how the Qandidate developers manage to divide their attention between "regular" work and "open source" work. Broadway is not just a small library to maintain, it's an actual framework. It still doesn't have an aweful lot of users, but nevertheless: it does take a serious amount of time to deal with issues and pull requests for it. Currently, the team is allowed to spend some time on this during working hours, which is really great. Adding new features doesn't often have a high priority though, since these are often features required by the community, but for the company itself there is no urgency. Judging by the way some of the current pull request are being handled, I personally feel that the current situation is just fine though.

Event store management

Currently several features are being worked on which are related to "event store management". The current version of Broadway's event store can't be queried for events of a certain type (the class of an event). Being able to do so would be nice, since it allows you to replay just certain events and let read model projectors process just a slice of all the events. Some people want to take this even further and want to be able to query for data inside stored events. This requires query/indexing capabilities within JSON blobs (event objects are always serialized to simple arrays, then persisted as JSON strings). This is impossible when using a MySQL database. But it was suggested that it might be possible if the events would be stored in a PostgreSQL database instead of a MySQL database like it currently is. The Broadway team itself is not fully convinced if querying the event store should be very convenient, but they imagine it can be useful in some high-performance environments.

Replaying events

Event stores are very powerful once they are combined with projectors. A projector can subscribe to domain events and produce read models based on what's changed in the write model. In general, each use case (a list of things, a detailed view of a thing, a list of the same things but this time just for administrators, etc.) requires a new read model projector as well as a new read model. The general recommendation by the Broadway team is to not always follow this advice blindly. If read

Truncated by Planet PHP, read more at the original (another 9802 bytes)

PHP ClassesReview: PHP Cookbook 3rd edition (23.7.2015, 03:46 UTC)
PHP Cookbook 3rd edition
Jose Gomez
PHP books
David Sklar, Adam Trachtenberg
This is really a very good book for intermediate and advanced users. I missed a couple of tips like Web scanner references and a chapter describing Web services.

Together with a reference guide it is the perfect tool for PHP developers because it covers the most important aspects and purposes of PHP development using a mini how-to recipes collection structure. These recipes consider performance, memory usage and code readability topics.

It is a roadmap from the PHP basic concepts (strings, numbers, date and time, arrays, variables, functions and classes) to the main purposes of the PHP language like web programming (cookies, headers, sessions, forms, database access, RESTful APIs, XML documents, security and encryption, graphics, internet services and internationalization), extensiona and functions for debugging and profiling, file and directories handling, PHP usage from command-line and packages usages.

This book enumerate tools, extensions and compilation options to access to the functionality recommended in the book.
Lorna MitchellNew Screencast Series: Git Fundamentals (22.7.2015, 08:52 UTC)

git-fundamentals-screencastIf you're a web developer looking to improve your git skills, then I have just the thing for you. I love it when a project is finished and "out there" and I'm pleased to announce that my new screencast course Git Fundamentals For Web Developers is now available. It's mostly PHP but you'll find Python and Node examples in there as well just to show off some of the tricks that work best for different disciplines. The course is structured around specific tasks or problems that we face in creating and deploying web applications, and my best advice on how to solve them. Mostly, I just want you to be able to be awesome at what you do already without your source control tool getting in the way :)

Edit: If you're reading this before July 25th 2015, use code CFSCON5 to get a massive 50% off!

Screencasting was a fun medium, I can chatter but I don't have to feel self conscious about being on video, and I can record a few episodes at a time as my schedule allows. Most of the work is in the preparation which I can do when I'm travelling, and just capture them when I'm in a good, quiet place with all my audio kit. This course was recorded over about a month, mostly in the early morning, and was only slightly hampered by my laptop dying completely in the middle of the process (doh!). I hope this finished version works both as a reference and as a full course to follow along with and try out for yourselves

PS if you buy the course, please leave a review on the O'Reilly site so others know if it is useful and for whom .... I'd appreciate it!

New Screencast Series: Git Fundamentals was originally published on LornaJane by Lorna. Lorna is a web development consultant, tech lead, author, trainer, and open source maintainer, and she is occasionally available for freelance work.

LinksRSS 0.92   RDF 1.
Atom Feed   100% Popoon
PHP5 powered   PEAR
ButtonsPlanet PHP   Planet PHP
Planet PHP