Feed aggregator

SitePoint PHP Blog: Composer Cheatsheet

PHPDeveloper.org - Tue, 01/04/2014 - 18:22

The SitePoint PHP blog has a new post from Matthew Setter today sharing a Composer cheatsheet he recently discovered with an example of the common commands and "composer.json" file structure.

Unless you've been living under a rock, today's PHP isn't your grandmother's PHP; it's an entirely different, much more elegant and mature language with countless improvements and additions. One of the key additions is Composer, the de facto standard for managing PHP project dependencies which, by default, gives you access to hundreds of ready-made libraries, via Packagist.org.

He goes through the parts of the guide, introducing some of the commands and covering the details of the full "composer.json" JSON structure. There's also a video introduction if you'd like the more visual version.

Link: http://www.sitepoint.com/composer-cheatsheet

AWS PHP Development: Receiving Amazon SNS Messages in PHP

PHPDeveloper.org - Tue, 01/04/2014 - 17:53

The Amazon Web Services PHP Development blog has a new post from Jeremy Lindblom showing you how you can receive inbound SNS messages via a webhook on your application.

Amazon Simple Notification Service (Amazon SNS) is a fast, fully-managed, push messaging service. Amazon SNS can deliver messages to email, mobile devices, Amazon SQS queues, and HTTP/HTTPS endpoints. [...] Though you can certainly subscribe your email address to receive SNS messages from service events like these, your inbox would fill up rather quickly. There is great power, however, in being able to subscribe an HTTP/HTTPS endpoint to receive the messages. This allows you to program webhooks for your applications to easily respond to various events.

Using the AWS SDK for PHP you can set up a listening script that can receive the message and handle subscription confirmations, message signature validation and handling the notifications.

Link: http://blogs.aws.amazon.com/php/post/Tx2G9D94IE6KPAY/Receiving-Amazon-SNS-Messages-in-PHP

Pádraic Brady: Is Facebook's HHVM Building PHP's Coffin?

PHPDeveloper.org - Tue, 01/04/2014 - 16:31

In a new post to his site, Pádraic Brady poses a question about the HHVM project from Facebook - is it going to "be the coffin" that will replace the Zend Engine in PHP completely and change the way we know it?

With HHVM 3.0 now released, it's probably time to start talking about HHVM and the new Hack Language. It's becoming hard to ignore some of the fantastical notions spreading on the grapevine about HHVM. There is talk of significant performance improvements, a multitude of new features courtesy of Hack, that PHP Internals is actually now outnumbered by HHVM contributors. There is even treasonous talk of PHP's Zend Engine being put out to pasture.

He talks about how it was inevitable, really, that there'd be another implementation come up through the ranks (much like the variations of Ruby). He also mentions some other, less popular options in replacing the main implementation (Zephir, HippyVM, etc). He then poses an interesting question - "what is PHP?" He talks about language specifications, the PHP internals group and the delay that sometimes happens introducing new language features into the core (some of which HHVM already has).

PHP, as we know it, is starting to smell. It has gone from being the only PHP in town, to being the slowest, with the least number of features, and the one that's subject to dysfunctional governance. The new PHP is called Hack, a new language with only the briefest of documentation since you can learn the other 99.9% of this language over on the PHP manual. Link: http://blog.astrumfutura.com/2014/03/is-facebooks-hhvm-building-phps-coffin

Community News: Latest PECL Releases for 04.01.2014

PHPDeveloper.org - Tue, 01/04/2014 - 14:06
Latest PECL Releases:
  • uopz 2.0.1 fix build error in some setups

  • uopz 1.0.7 fix bug in applying method modifiers

  • uopz 1.0.8 fix bug in applying method modifiers work on uopz_compose, compose classes in one function call is possible

  • qb 2.2.0 Enabled compiling to native binary in Solaris and FreeBSD Fixed issue #29 - Segfault during array resize in Solaris Fixed issue #32 - Segfault when images are resized or created Fixed issue #33 - Incorrect CPU count Fixed issue #34 - Inability to call functions inside namespace Fixed issue #35 - Segfault in PHP 5.5.8 when QB coroutine is called Fixed issues flagged by Valgrind

  • uopz 1.0.9 fix bug in finding functions, affecting various add more tests

  • uopz 1.0.10 take properties to compose

  • uopz 1.0.11 fix unresolved external symbols on some builds fix bug in overload for add trait/interface

  • uopz 2.0.0 API finalized, no moar changes fix logical error in uopz_extend fix logical errors in uopz_compose enforce using correct handlers (stability++) fix scope issue in global functions created with uopz_function take modifiers to uopz_function for global functions fix bug in uopz_delete on magic methods

  • uopz 1.0.6 fix memory error causing segfault in auto backup allow composition of interfaces and traits enforce inheritance rules while composing classes

  • pthreads 2.0.4 fix memory errors introduced in 2.0.0 fix 5.3 build synchronize versions

  • uopz 1.0.5 fix various scope issues use exceptions where appropriate tidy all code add some more tests

  • eio 1.2.5 Fix: Bitbucket issue #2: Static build fails Fix: build failed when EVENTFD was not available

  • pthreads 2.0.3 Fix bug in trait alias/precedence (gh bug #274) Fix leak (gh bug #272)

  • uopz 1.0.4 add copy fix various scope issues fix heap corruption issue auto backup on uopz_function

  • qb 2.1.2 Fixed issue #17 - Segfault with large fixed length array Fixed issue #19, #28 - Errors in Solaris 11 Fixed issue #20 - Corruption of pass-by-ref variables Fixed issue #21 - Conflict with xdebug in FreeBSD Fixed issue #24 - Broken ZTS build Fixed issue #27 - Incorrect object import

  • timezonedb 2014.2 Updated to version 2014.2 (2014b)

Walking the London LOOP - part 5 and 6

Derick Rethans - Tue, 01/04/2014 - 10:11
Walking the London LOOP - part 5 and 6
Section 5

While waking up we already knew this would be a glorious day. Blue skies with no clouds in sight. The moment I got out of the house I knew I was not going to need my coat either. Getting to Hamsey Green, the start of section 5 was a bit more of a chore than normally. It involved two tube trains to Victoria, a train to West Croydon and then another bus ride down the road to Ken's Auto at Hamsey Green.


After a short section next to a road, we entered Riddlesdown. With mostly open fields and a bit of woodland we made it down into the next valley, coming past a disused quarry. We only really noticed the quarry once we made it over a bridge across some railroad tracks and up a fairly steep path up the hill on the other side of the valley.


After some steps, and some more steep uphill part we came to Kenley Common, a now open space that used to be farmland, as a swap for the Kenley Aerodrome that the RAF seconded during the second World War. We made a few wrong turns on Kenley Common and there were a few slightly useless fences. Passing through some woods and a field with gliders overhead, we "suddenly" found ourselves at the Wattenden Arms, a pub displaying much WWII memorabilia from the Kenley Aerodrome. The friendly staff served a decent pint, and after refreshing ourselves we continued the walk.

After climbing our first style we were overtaken by another LOOP walker as we passed by the Kenley Observatory and a friendly horse. For a bit we had to walk past a road without footpath or pavement.


After that we passed by a field with a sole postbox and then made our way to Happy Valley. With the Sun blazing and everything looking greener that it probably was we descended into the valley and back out on the other end. The signing of the LOOP was a bit confusing so I don't think we followed the route correctly, but we picked up the walk again just shy of the next common, Farthing Downs.

This part of the walk was over a hill crest with the skyline of London in the far background. The section ended with a slight downhill into Coulsdon were we stopped for some refreshments—most importantly cake—at the Poppy Cafe. Because the weather was so nice, we decided to continue with the following section as well, section 6.

Section 6 loop6-d36_5021.jpg

Passing through South Coulsdon station we had a long climb up a residential road before we continued on a bridleway. With a long section through some woods and farmland around, a slight detour around a road without pavement, we came upon the Mayfield Lavender Fields. Sadly, we were too early to see it all in bloom, but there was most definitely already a hint of purple to be seen.


We then walked through Oak's Park, after which there was another long straight section on the edge of Surrey that took us past HMP Highdown. Luckily most of it was hidden by hedges and trees. The last part of this much shorter section took us to the Banstead Downs and over the Banstead Downs Golf Club to the end of the walk. From there it was a short link to Banstead, where we luckily only had to wait 20 minutes for the train—there is only a service every hour.

Where section 5 was mostly known for its up and downs, section 6 was the "horse" section. Lots of bridleways and horses around.

The weather was very good, with 16-18°C and no clouds to be seen. We took nearly four and a half hours for the two sections that together were 19.4km long.

The photos that I took on this section, as well as the photos of the other sections of the LOOP, are available as a Flickr set.

Categories: Open Source, PHP Community

Oracle Improves Database Performance with Latest Development Milestone Release for MySQL 5.7

MySQL.com - Tue, 01/04/2014 - 02:59
New Release of the World’s Most Popular Open Source Database is 2x Faster than MySQL 5.6 and Over 3x Faster than MySQL 5.5 in Benchmark Tests
Categories: PHP Community

New sabre/dav website launched!

Planet-PHP - Mon, 31/03/2014 - 23:16

We just released a brand new website for sabre/dav, on http://sabre.io. This new site is completely built on Sculpin, which is the best static site generator for PHP.

This was a long time coming! sabre/dav had always been hosted on google code, but as google started caring less and less about their code hosting property, it was time to look for a change.

Over time issues and source had already migrated to GitHub, but the biggest thing left was the wiki, which required porting of the google wiki markup.

We started work in October, and finally we finished enough stuff that we're comfortable releasing it.

Now I can go all out writing news stories there too. For the longest time this was my only blog, so I felt like I had to make sure I didn't over-broadcast sabre/dav related news, in order to not sound spammy and toot my own horn too much.

Go subscribe!

And yes, we also changed the branding from SabreDAV to sabre/dav. We've been with composer since the early days, and the typograpgy now matches the composer package name :).

Flexible boxes

One nice thing was that since this is a website primarily targetted towards technologists, I've also felt a lot safer taking advantage of all the latest features, and ignoring pretty much any browser that's not the most recent.

Since a little while we now have an awesome new CSS layout feature: flexible boxes.

Having worked with this a little bit (and many years ago too in XUL), I feel I can safely say, that within a few years, 90% of you will be using this feature, as opposed to CSS grid systems, absolute positioning, float, etc.

Your css source will be greatly reduced. You can automatically re-order DOM objects based on screen-size, you will need a lot less container divs and you can say goodbye to shitty css classes that frameworks such as bootstrap require.

If you've ever had to do any html layouts (and I'm sure you have, and will again), do yourself a favor and learn about it!

Everything was also writting from the ground up using box-sizing: border-box, which makes the css math a lot easier as well.


We'd love to hear what you think. Any bugs? Let us know in the comments.

Categories: Open Source, PHP Community

How to kill creativity, part 1

Planet-PHP - Mon, 31/03/2014 - 23:05

Edit: I recommend reading this article first and then watching the video afterwards. It will make more sense in this order.

I first viewed this enlightening lecture on creativity by John Cleese (Monty Python) a few years ago. Since then, I saw an incredible progress in my problem-solving skills and generated countless creative ideas.

John Cleese explains that creativity is not a talent. It is a way of operating. It is a facility of getting yourself into a particular mood. It is an ability to play with ideas, for no immediate practical applications. And it worked miracles for me.

So now imagine a meeting in a company which aims to solve a problem. It typically has a fixed agenda, includes as many people as could be gathered and the solution has to be taken by the end of the meeting. These mistakes hinder creativity.


The agenda forces you into accomplishing a list of tasks, which is associated with the closed mode, the one in which creativity cannot be achieved. It’s alright if you need an update or get everyone on the same page, but not when you want a creative solution. I recommend splitting the meeting into a few of them, preferably 60-90 minutes each. State the problem at hand and start exploring solutions (not seeking them).

The wrong attitude

When solving problems, you need to bounce ideas back and forth. Having too many people or people who dismiss each other’s ideas is not helpful. When you’re exploring possibilities and someone tells you that it’s ridiculous, you’re no longer in a mood to play. I recommend only inviting a handful of people to the meeting (no more than 5). Tell them not to be afraid to throw ideas, because no idea is wrong at this point. Tell them not to mock other ideas, since bad ideas can lead to good ones in the creative process.

Pressure for immediate solutions

Some problems are hard to solve and require additional pondering time. Pressuring for a decision leads to poor decisions. In the best case, you’ll be missing out on creative solutions because pressure always put people in a focused, closed mode. If the decision can be postponed without consequences, then give people some time to digest the ideas heard and reconvene another time. The meeting should remain an exploration until the time comes to actually making the decision.


Achieving creativity takes practice. Listen to the video and try to remember to switch into open mode when devising any sort of strategy. I will post another article in the coming days to explain how I apply his 5-step guideline in the context of an IT project.

Categories: Open Source, PHP Community

Is Facebook’s HHVM Building PHP’s Coffin?

Planet-PHP - Mon, 31/03/2014 - 22:00


English: THIS IS SPARTA (Photo credit: Wikipedia)

With HHVM 3.0 now released, it’s probably time to start talking about HHVM and the new Hack Language. It’s becoming hard to ignore some of the fantastical notions spreading on the grapevine about HHVM. There is talk of significant performance improvements, a multitude of new features courtesy of Hack, that PHP Internals is actually now outnumbered by HHVM contributors. There is even treasonous talk of PHP’s Zend Engine being put out to pasture.

Perhaps worse, HHVM 3.0 is following in 2.0′s steps: It is steadily eroding away at the notion that Facebook is going to abandon HHVM tomorrow (specifically at tea time once Mark has finished his crumpets) and it’s reinforcing the notion that Facebook actually wants people to adopt HHVM…as if running framework test suites and blogging about PHP parity every other day didn’t clue you in. Before 2.0, you’d swear the whole project was either top secret or had been disavowed.

This Was Inevitable…

PHP is not the only language to have faced multiple implementations. Ruby MRI (Matz’s Ruby Interpreter) is the “original” Ruby. It now puts up with JRuby, Rubinius, IronRuby, MagLev and MacRuby (where would we be without an Objective-C option, right?). Python is also not alone. It has alternatives (a lot of them) but you’d most likely recognise IronPython, PyPy, and Jython.

PHP is merely doing what it does best – creeping up on other languages and stealthily “borrowing” the best of their advantages. This time it’s not actually PHP doing the creeping, however, and beating PHP at the catchup game is a big deal. Just in case you haven’t heard – even HHVM is hardly the only option for PHP either. You can use Zephir to write PHP-like code which compiles to a PHP extension. Recently, I heard about HippyVM which appears to be in its infancy though those kids can grow up very fast (and it’s association with PyPy means it can’t be dismissed out of hand). There’s also the penultimate “opt-out” options for converting PHP out to Java, for example. The ultimate option being to just maintain the output and dump PHP altogether. Never overestimate your PHP code’s permanence ;) .

I haven’t really discussed HHVM anywhere because the equation Facebook presented us with just didn’t add up for my particular circumstances. Now it does. HHVM is becoming ever more compelling as the weeks roll by. The PHP parity quest, the Hack Language, the shift to FastCGI and, most importantly, HHVM’s rapid improvement over time are creating something extremely attractive. Yes, it performs really well, but that’s not always the most relevant factor to programmers on the ground churning out everyday applications.

To PHP or not to PHP?

I’m seriously thinking about using the damn thing! This poses one small troubling question which keeps gnawing away at my poor brain: What is PHP?

PHP is a language without a specification to define all of its behaviour. It exists as one implem

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

Categories: Open Source, PHP Community

Michael Dowling: Guzzle 4.0

PHPDeveloper.org - Mon, 31/03/2014 - 20:57

Michael Dowling has announced the release of Guzzle 4.0.0 on his site today. Guzzle is one of the most widely used, popular HTTP clients in the PHP community today. Its used in both corporate and open source projects as a primary means for making HTTP requests and RESTful web service clients.

Guzzle 4.0 has arrived! The new version of Guzzle is now simpler, faster, more flexible, and more powerful than ever. [...] Guzzle is a PHP HTTP client that makes it easy to work with HTTP/1.1 and takes the pain out of consuming web services.

He includes a quick example of it in use making a request to the GitHub API to fetch user information. He lists out some of the changes made in this release but points to this other post for the full list. He's also tagged other related projects to match this 4.0.0 release including Guzzle Streams and the Log Subscriber.

Link: http://mtdowling.com/blog/2014/03/29/guzzle4/

Evert Pot: PHP 5.5.10 timezone handling changes

PHPDeveloper.org - Mon, 31/03/2014 - 19:29

Evert Pot has a new post sharing some of the changes in DateTime handling that he's updated in the latest release in the PHP 5.5.x series.

PHP 5.5.10 got released a few weeks ago, and among other things, it added some new functionality related to timezone handling. In short, [subtracting from UTC] now works. Normally this would not be recommended, as you really should specify timezones based on their geographical location. This information is not always available though, so it's a welcome new feature.

Other changes include the removal of the automatic translation from "UTC" to "GMT" as well as errors being thrown when one of the "odd" timezones are used (he provides the list). Additionally, an update around timezone "guessing" has been added and the fallback that was in place has been removed.

Link: http://evertpot.com/php-5-5-10-timezone-changes/

NetTuts.com: Test Code Coverage: From Myth to Reality

PHPDeveloper.org - Mon, 31/03/2014 - 18:50

There's a good post over on the NetTuts.com site today talking about unit testing, the myths around code coverage and why it may not be as important as you think.

Most cubicle workplaces disappeared and programmers started loving their craft. With the advent of Agile techniques and the Software Craftsmanship movement, many new tools emerged to help the programmer and the process. TDD is slowly becoming the de facto way of writing code and the secrets of SCRUM or Kanban were revealed even to the programmers in the darkest corners of the cubicle world. Automated testing and test driven development (TDD) are some of the essential techniques Agile provided to us programmers. And a tool that comes with those methodologies is used to produce test code coverage, which is the topic of this article.

The article starts with a brief definition of code coverage and gets right into an example class, PHPUnit test and the results of a code coverage generation. They show both output options, the text-only output and the full HTML output with clickable links and visualization of the covered lines of code. There's also an example of generating the coverage inside an IDE (PHPStorm). The post finishes with a look at the myths of code coverage including: "100% covered is bug free" and that "gaming the system" is pretty easy.

Link: http://code.tutsplus.com/articles/test-code-coverage-from-myth-to-reality--cms-20442

Composer Cheatsheet

Planet-PHP - Mon, 31/03/2014 - 18:00

Unless you’ve been living under a rock, today’s PHP isn’t your grandmother’s PHP; it’s an entirely different, much more elegant and mature language with countless improvements and additions.

One of the key additions is Composer, the de facto standard for managing PHP project dependencies which, by default, gives you access to hundreds of ready-made libraries, via Packagist.org.

I’m not going to go over how to use Composer, as it’s been covered so well here on SitePoint already; especially by this article, by Alexander Cogneau.

Instead, I’m approaching it from a different angle, taking you through the excellent Composer cheat sheet, which I came across recently.

Continue reading %Composer Cheatsheet%

Categories: Open Source, PHP Community

HHVM Blog: HHVM 3.0.0

PHPDeveloper.org - Mon, 31/03/2014 - 17:15

The HHVM blog has an exciting new post for those using the HHVM and Hack language - they've officially released version 3.0.0 with complete Hack support.

At our last major version bump (2.0.0), we basically became a whole new project. We switched from a "PHP -> C++" translator to a virtual machine. This version bump (3.0.0) is a much less dramatic code shift (we're still a VM, don't worry), but this time the big announcement is that we support a new language, Hack.

They take a step back in time and look at the changes since 2.0.0 in organization, technology and community involvement. From there, they get into "the business" of what's in this new release including:

  • The old webserver is gone. If you get something like Uncaught exception: no factory for server type "libevent", you need to switch to fastcgi.
  • We are moving from .hdf config files to .ini.
  • Our most requested extension, mysqli is now in. (there's currently a bug, but the fix will be in 3.0.1).

You can find out more about the HHVM on the project's main website.

Link: http://hhvm.com/blog/4349/hhvm-3-0-0

“Modernizing Legacy Applications in PHP” Update: Schedule, and Reviews

Planet-PHP - Mon, 31/03/2014 - 16:52

Today was my scheduled date for publishing the final edited copy of Modernizing Legacy Applications in PHP. Although the writing itself is complete, it has yet to finish its final editing pass. As such, the final version of the book is going to be delayed by at least a week. My apologies for the delay.

Even so, we have new reviews of the completed book! Here is one from J. Michael Ward:

Superb. This is one of those books that PHP developers from all skill levels will be able to glean value from, and I know after just a single read-through that it will be an oft-referenced resource when I need to convert my old legacy-based procedural code into something cleaner, object-oriented, and testable.

This is a very thorough guide to understanding how to write object-oriented programming in PHP in 2014 and getting developers stuck with legacy codebases up to speed with the tools that are available to them. I will recommend this to anyone who will listen.

And another from James Fuller:

The book is full of opinions on how to structure an application, but it thankfully avoids the trap of coming off as over-zealous and judgemental. The people who need this book know that legacy code is not a black-and-white problem and the tone of the book is both sympathetic and prescriptive.

The book is by no means overly-verbose, as you can read through it in a few well-spaced hours. I think that’s a good thing and you will probably find yourself going back to the book for reference time-and-time again, as I have already done in the period since I bought the book in beta. Occasionally you will have the annoying task of flipping to an appendix to read a large block of code but that is really a problem with any book that discusses code in detail.

And yet another from Joel Clermont:

Reading through the book, it feels like you’re pair programming with the author. I’m at the keyboard, driving, and the author is navigating, telling me where to go and what to do next. Each step is practical, self-contained and moves you closer to the end goal you seek: maintainable code.

I highly recommend this book. Even if you’re a seasoned developer like me (I’ve been writing code professionally more than 20 years), you will benefit from Paul’s approach and detailed documentation of the process.

If you feel overwhelmed by a legacy codebase, go out and buy Modernizing Legacy Applications in PHP today. (Updates are free for life.) The sooner you get started modernizing, the sooner you can start going home on time!

Categories: Open Source, PHP Community

Securing PHP: The Usual Suspects Released

Planet-PHP - Mon, 31/03/2014 - 16:49

I’m happy to announce that the next book in the popular “Securing PHP” ebook series has been released – “Securing PHP: The Usual Suspects”!

You are the developer, you hold the power in your hands to protect your users and their information. They trust you with it, shouldn’t you do everything you can to keep that trust?

Let me guide you through a look at some of the most common issues with web applications and suggest ways to correct them along the way. Even if you’re a novice to security or to PHP, this book can help you get started down a more secure path. The OWASP Top 10 is a great guide to the common vulnerabilities, but it doesn’t provide the useful, concrete examples you need to be a more effective and secure developer. I’ll provide this foundation on topics like:

  • Cross-site scripting, what it is and how to prevent it
  • Poor authentication and authorization practices
  • Preventing several types of injection
  • Auditing potentially vulnerable components
  • Protecting your users’ sensitive data

This book will help you sleep better at night knowing you’ve put in the time and work to protect your applications and the users that trust it.

You can grab a copy of it over on LeanPub right now for just $19.99 USD. The book is on an incremental rollout schedule, so right now just the first two chapters are included. The first covers various injection types (including SQL injection, one of the most widespread) and how to prevent them in your applications. The second chapter covers some of the common problems around authentication and authorization.

Categories: Open Source, PHP Community

SitePoint PHP Blog: Image Scraping with Symfony's DomCrawler

PHPDeveloper.org - Mon, 31/03/2014 - 16:06

On the SitePoint PHP blog today there's a new post showing you how to use the Symfony DomCrawler component to scrape content, images mostly, from a remote website. The DomCrawler is one component of the Symfony framework.

A photographer friend of mine implored me to find and download images of picture frames from the internet. I eventually landed on a web page that had a number of them available for free but there was a problem: a link to download all the images together wasn't present. I didn't want to go through the stress of downloading the images individually, so I wrote this PHP class to find, download and zip all images found on the website.

He talks briefly about how the class works and then gets into the contents of the class. He walks through all the code and explains in chunks what each part does in the lifecycle of the request. The end result is a Zip archive file of all images from the remote website, packaged up for easy transport.

Link: http://www.sitepoint.com/image-scraping-symfonys-domcrawler/

Community News: Packagist Latest Releases for 03.31.2014

PHPDeveloper.org - Mon, 31/03/2014 - 15:08
Recent releases from the Packagist:

Five Tools I Can’t Develop Without

Planet-PHP - Mon, 31/03/2014 - 13:00
In 2011, I wrote about the five tools I couldn’t do without at the time. But times change, and so do the essentials we have. While some of those tools still hold true (like issue trackers and the PHP variable output functions), there are other new tools that are essential components of development. Here’s my […]
Categories: Open Source, PHP Community
Syndicate content