PHP 7, the next version of the world’s most popular programming language, has been released. We’d love to shoot fireworks and get drunk with our newfound power (seriously, the language is in the true big leagues now, functionality and performance-wise) but we’re sure the rest of the internet will do this for us. Instead, we’ll focus on compiling a (perpetually up to date) list of resources to get started with version 7 – posts describing what’s new, books helping you kick things off, and more. Let’s get to it!
What Happened to PHP 6?
When told the next major version is 7 while we’ve been developing on 5+ so far, many wonder what happened to version 6. It’s a long story, so to avoid looking confused when this is brought up, here are some interesting discussions and posts as required reading:
In short, the unicode problems that were supposed to be solved in version 6 ultimately failed, with too many added complications, and this kind of ruined things for everyone. It was decided that version 6’s rep was too damaged to keep it alive, and a move to PHP 7 was made.
We’ve spoken about the new features briefly before, but here’s a more comprehensive list of links to information about them – now’s the time to dive in and get ready.
To learn about what’s coming and what an impact it might have on you:
- Official list of new features
- Super comprehensive list on Github
- What to Expect series
- PHP7 at a glance
- DigitalOcean’s look at new features
- Colin O’dell’s 5 Lesser Known Features, just one in a set of several very useful PHP 7 posts of his
If you’re into video lessons and don’t mind paying for them, two sites covered basically the same thing:
- Codecourse at https://www.codecourse.com/library/lessons/php-7-new-features
- Laracasts at https://laracasts.com/series/php7-up-and-running
To learn about the type system, arguably the biggest change, and how it compares to hack:
Getting Started with PHP 7
- If you’re not of the VM sort, to install PHP 7 on the most recent version of OS X, see http://php-osx.liip.ch/
- If you are, however, there’s Jump Start PHP Environment – a book by yours truly, edited and reviewed by the venerable Ross Tuck. It’s a short book on getting started before code – learning about requests, responses, virtual machines, and all the other important server and local development machine setups. The book helps prepare you to write platform-agnostic code, and makes it possible for others to just jump into your team at a whim.
- Paid intro course from Zend – good for people familiar with PHP 5 who don’t mind shelling out some cash
- Official migration guide from 5.x
- Erika’s excellent post on DigitalOcean
Various compatibility checkers and converters are available:
- PHP7MAR (Migration Assistant Report) will report any inconsistencies between your current code base and PHP 7, so you can plan and budget your upgrade path
- php7ize is a code fixer that tries to add PHP 7 features into a PHP 5 codebase automatically
- php7cc (Compatibility Checker) will try and do the same things as the MAR above – compare their outputs for the most reliable results.
It should be noted that none of the tools above are a replacement for a good test suite – the only way to be 100% certain there’s no bugs left behind is to cover your code with tests so it can be easily inspected and verified during migration.
Last but not least, PHPToday have put together an absolutely fantastic list of talks which you can take a look at here.
Tools, testing and hosting
Lots of helpful tools have already sprung up around the new release:
PhpStorm, ahead of the pack as ever, already comes with full PHP 7 mode.
Exakat is another analyzer
Tuli is yet another – but development is somewhat halted. If anyone wants to write a comparison post targeting all three, let us know!
Andrea Faulds threw out some interesting PHP 7 exclusive packages that warrant a look!
Travis CI has supported PHP 7 for a while now. Setting a project up to be 7-tested is easy, just make your
.travis.ymlfile look something like this:
language: php php: - 5.6 - 7.0 - hhvm # This triggers builds to run on the new TravisCI infrastructure. # See: http://docs.travis-ci.com/user/workers/container-based-infrastructure/ sudo: false matrix: allow_failures: - php: 7.0 before_script: - travis_retry composer self-update - travis_retry composer install --no-interaction --prefer-source script: - phpunit --coverage-text --coverage-clover=coverage.clover after_script: - if [[ $TRAVIS_PHP_VERSION != 'hhvm' && $TRAVIS_PHP_VERSION != '7.0' ]]; then php vendor/bin/ocular code-coverage:upload --format=php-clover coverage.clover; fi
Right now, the hosting space is rather sparse for PHP 7, but keep an eye on http://phpversions.info/php-7/ – the list will be updated as new information rolls in.
For resources on developing extensions for PHP 7 (things are bit different with the extension API), http://gophp7.org/gophp7-ext/ is still the go-to site.
To join communities and discuss things or seek help, some of the following may be of help, in order of popularity:
- On IRC, the ##php group on freenode will be of use
- For those in favor of a more static medium, the PHP subreddit can be a place of knowledge, but also a minefield. Tread carefully.
- If you’re not of the IRC or Reddit kind, but like live discussion nonetheless, there’s the PHP Slack Channel and the StackOverflow PHP chat room
- To join a user group for some offline hanging out, check out http://php.ug/
More from this author
Got more resources to share? Let us know! Paid or not, we’ll look at everything you throw at us and potentially include it.
With PHP 7 out, do you intend to convert your apps/packages any time soon? If not, why? Let us know your thoughts and feelings below! And don’t forget – the new version wouldn’t have been possible without the hard work of all the core contributors. They may not always all see eye to eye, but when they pool their resources and run towards a common goal, the sky’s the limit. Here’s to you, champs, thanks for keeping the web epic!