PHP.net

Coding the Architecture: Five things every developer should know about software architecture

PHPDeveloper.org - Wed, 05/03/2014 - 19:57

While not specific to PHP, this new article on the Coding the Architecture blog gives some good insights on what developers should know about software architecture.

Now I may be biased, but a quick look at my calendar hints to me that there's a renewed and growing interest in software architecture. Although I really like much of the improvement the agile movement has provided to the software development industry, I still can't help feeling that there are a large number of teams out there who struggle with a lack of process.

[...] Put very simply, software architecture plays a pivotal role in the delivery of successful software yet it's frustratingly neglected by many teams. Whether performed by one person or shared amongst the team, the architecture role exists on even the most agile of teams yet the balance of up front and evolutionary thinking often reflects aspiration rather than reality. The big problem is that software architecture has fallen out of favour over the past decade or so. Here are five things that every software developer should know about it.

Each of the five things comes with a paragraph of explanation (and some links to additional resources):

  • Software architecture isn't about big design up front
  • Every software team needs to consider software architecture
  • The software architecture role is about coding, coaching and collaboration
  • You don't need to use UML
  • A good software architecture enables agility
Link: http://www.codingthearchitecture.com/2014/03/05/five_things_every_developer_should_know_about_software_architecture.html

MakeUseOf: Create The Perfect PHP Development Environment In Android

PHPDeveloper.org - Wed, 05/03/2014 - 18:39

On the MakeUseOf site there's a recent post showing how you can create the "perfect PHP development environment" on your Android-based device. Obviously, it's much more useful on a tablet, but in theory it could be used on a smartphone.

It turns out you can actually code on Android productively. For the longest time, it has been accepted that whilst computers are for productivity and creativity, Tablets exist purely to allow the passive consumption of content. I believed that as well. I'm a software developer by trade, and I use a 13" Macbook Pro to write all my code. I wouldn't have it any other way. OS X comes with everything I need to be productive as a developer, and I've built my workflow around that. Android on the other hand? I've never really thought about writing code on Android. [...] But then I bought a decent Bluetooth keyboard, and everything changed. I've now built a PHP development environment around my 2012 Nexus 7 tablet, and I love it.

He breaks it down and shows some of the tools he uses for his development including the use of VIM Touch for editing and the Palapa Web Server for local hosting of his applications. Screenshots of the setup and configuration are also included. Link: http://www.makeuseof.com/tag/create-perfect-php-development-environment-android/

Gonzalo Ayuso: Auto injecting dependencies in PHP objects

PHPDeveloper.org - Wed, 05/03/2014 - 17:19

In his latest post Gonzalo Ayuso shows how you can automatically inject dependencies into your PHP objects with the help of Pimple, a simple dependency injection container.

I must admit I don't really know what's the correct title for this post. Finally I use "Auto injecting dependencies in PHP objects". I know it isn't very descriptive. Let me explain it a little bit. This time I want to automate the Hollywood Principle ("Don't call us, we'll call you"). [...] We need to use Reflection to create our instance and to call our action. Sometimes I need to work with custom frameworks and legacy PHP applications. I've done it in a couple of projects, but now I want to create a library to automate this operation.

He includes a simple example of a "Controller" class that is injected with a "Request" via constructor injection. He refactors this to create the dependency injection container with a "Builder" class) and shows how to fetch the instance of the "Bar" class from it. It's this Builder class he shares on GitHub.

Link: http://gonzalo123.com/2014/03/03/auto-injecting-dependencies-in-php-objects/

Community News: Packagist Latest Releases for 03.05.2014

PHPDeveloper.org - Wed, 05/03/2014 - 16:08
Recent releases from the Packagist:

ServerGrove Blog: Symfony2 components overview: Validator

PHPDeveloper.org - Tue, 04/03/2014 - 20:55

The ServerGrove blog has posted their latest in-depth look at one of the many components that make up the Symfony2 framework. In this latest post they cover the Validator component, another well-used part of the framework.

In the first five posts of this series we have been talking about key components for any PHP framework from the point of view of their internals, such as HttpFoundation to abstract the HTTP protocol, HttpKernel to convert a Request into a Response, Routing to map requests to controllers, EventDispatcher to add reusability and extensibility, and Config to load and validate configuration values. This time we'll delve deeper in the user space to describe a component that is for specific apps rather than just for frameworks. Today's topic will be the Validator component.

They start off talking about a common problem in web applications, running validation on incoming data, and how the component can help. The article then gets into the architecture of the component and provides a simple example of it in use (validating an integer range). They talk about some of the built-in validations, the internationalization support and validation on objects, just just simple values. Finally, there's a look at creating custom validations, their example being a simple check on a given "programming language" string.

Link: http://blog.servergrove.com/2014/03/03/symfony2-components-overview-validator

SitePoint PHP Blog: Functional Testing in Symfony2

PHPDeveloper.org - Tue, 04/03/2014 - 19:16

Taylor Ren has written up a new tutorial for the SitePoint PHP blog today walking you through a method for functional testing a Symfony application with the help of Symfony's own "WebTestCase" functionality.

In my previous article, we demonstrated how to load sample data into our Symfony development environment. The test data may not be useful as it stands on its own. When coupled with Functional Testing, however, it becomes a life saver. [...] Functional Testing is different. We don't look at the "correctness" of a single function, which should be verified by a Unit Test, but look at the bigger picture. The question answered by Functional Testing is: Is our app performing well in the sense that it displays the right content, corresponds to a user's interaction, etc?

He shows how to create a simple WebTestCase-based test to fetch the main page of a site, locate a few pieces of information and click on a certain link. Once this test passes, he adds a bit more to the test, checking the data in the page following the click.

Link: http://www.sitepoint.com/functional-testing-symfony2/

HHVM Blog: Tracking Parity

PHPDeveloper.org - Tue, 04/03/2014 - 18:43

On the HHVM blog today there's a new post shows how far along they are with parity with the PHP language based on the tests from a sampling of several large PHP-based projects.

HHVM has a large suite of unit tests that must pass in several build configurations before a commit reaches master. Unfortunately, this test suite passing doesn't tell you if HHVM can be used for anything useful - so we periodically run the test suites for popular, open source frameworks. [...] The frameworks test page is now public, as is the JSON data backing it (which you're welcome to use).

They look briefly at what exactly is tested (latest stable version, with exceptions) and how it all works. The tests are run once an hour and are based on a completely clean build of HHVM in "csv" mode. The results of the tests are automatically pushed into the MySQL+Memcached system reporting system, accessible via the JSON API.

Link: http://www.hhvm.com/blog/3611/tracking-parity

Voices of the ElePHPant: Interview with Paul Jones

PHPDeveloper.org - Tue, 04/03/2014 - 17:23

The Voices of the ElePHPant podcast has released their latest episode in their community interview series. In this new episode Cal Evans talks with Paul Jones (lead developer on the Aura PHP framework).

They talk some about Aura project and the current status, including the work on the version 2 components and what's to come (recombining v2 packages back into the vs framework). They also talk about Paul's book Modernizing Legacy Applications.

You can listen to this latest episode either through the in-page player, by downloading the mp3 or subscribe to their feed.

Link: http://voicesoftheelephpant.com/2014/03/04/interview-with-paul-jones/

Community News: Packagist Latest Releases for 03.04.2014

PHPDeveloper.org - Tue, 04/03/2014 - 16:08
Recent releases from the Packagist:

Community News: Latest PECL Releases for 03.04.2014

PHPDeveloper.org - Tue, 04/03/2014 - 15:04
Latest PECL Releases:
  • solr 2.0.0b - Support Solr version 4.0+ - Added support for retreiving Solr Server system information through SolrClient SolrClient::system() - Support for softCommit - Suppport for expungeDeletes - maxSegments for commit is deprecated - Added escape character / as per Solr 4 it is reserved for REGEX - Disabled warnings for connection errors, SolrClientException is thrown - SolrClientException messages for connection errors are more meaningful indicating error messages and codes - API changes for: SolrClient::commit($maxSegments = 0, $softCommit = false, $waitSearcher = true, $expungeDeletes = false) SolrClient::optimize($maxSegments = 1, $softCommit = false, $waitSearcher = true) SolrClient::addDocument(SolrInputDocument &$doc, $overwrite = true, $commitWithin = 0) SolrClient::addDocuments(array &$docs, $overwrite = true, $commitWithin = 0) - Several Bug Fixes Warning: PECL Solr >= 2 is not compatible with Solr Server < 4.0

  • APCu 4.0.4 - Fix deadlocking due to destroyed locks - Fix various compatibility bugs

  • krb5 1.0.0 - [CLEANUP] Remove bundled kadmin headers, drop support for mit-krb5 <1.8 - [FEATURE] Support use of the krb5-config tool to determine library paths - [CLEANUP] Remove KRB5CCache->setConfig method as this is no longer supported by libraries - [BUG] Fix null-deref in isValid for uninitialized KRB5CCache

  • xdebug 2.2.4 Fri, Feb 28, 2014 - xdebug 2.2.4 = Fixed bugs: - Fixed bug #785: Profiler does not handle closures and call_user_func_array well. - Fixed bug #963: Xdebug waits too long for response from remote client - Fixed bug #976: XDebug crashes if current varibles scope contains COM object. - Fixed bug #978: Inspection of array with negative keys fails - Fixed bug #979: property_value -m 0 should mean all bytes, not 0 bytes - Fixed bug #987: Hidden property names not shown.

  • swoole 1.6.11 - Disable by default async_mysql - Disable by default sockets - Added event onWorkerError - Added event onWorkerStart for task_worker - swoole_server->task can assign worker_id - swoole_server->set() save params to swoole_server::$setting - swoole_client->send will check data length - swoole_server->connection_info for udp

  • mongo 1.5.0alpha1 ** Bug * [PHP-722] - Segfault when passing null value to MongoCollection::find() and unclear other conditions are met, inaccurate error message * [PHP-796] - Modifying MongoDate internal properties evilness * [PHP-813] - IS_SCALAR_*() doesn't account for resources * [PHP-815] - MongoCursor ctor doesn't validate the MongoClient object * [PHP-833] - Add the MongoClient::killCursor method to kill a cursor on the server on 64-bit platforms * [PHP-835] - Driver interprets 'err' property as MongoCursorException * [PHP-848] - Invalid read in master * [PHP-882] - mongo_connection_get_server_version memleaks * [PHP-883] - php_mongo_dbref_create() doesn't handle MongoId values * [PHP-888] - DBRef refactoring broke BC for $id parameter handling * [PHP-902] - Segfault when unregistering broken server * [PHP-949] - ensureIndex() creates wrong names * [PHP-955] - Switch the default mongo.native_long to 1 for 64bit platforms * [PHP-981] - Empty document should not throw exception ** Improvement * [PHP-578] - No need to call ismaster 2times * [PHP-705] - Throw exception when overflowing message size in OP_INSERT batches * [PHP-708] - WriteConcern failure exception should include the entire GLE document * [PHP-712] - findAndModify returns empty array when nothing is found * [PHP-774] - Deprecate the protected method MongoCollection::toIndexString * [PHP-807] - Rewrite to_index_string to use smart_str and a real C function * [PHP-812] - Remove unused MongoDBRef::$refKey and MongoDBRef::$idKey * [PHP-837] - Handle cursor IDs for return with MongoCursor::info on 32bit platforms * [PHP-851] - Add MONGO_HAVE_* constants and make sure MINFO contains this too * [PHP-880] - New write operation method for insert, update, remove * [PHP-886] - Add support for secondaryAcceptableLatencyMS * [PHP-903] - Improve the Stream Notification API * [PHP-941] - Throw MongoConnectionException on stream failures * [PHP-942] - Throw MongoDuplicateKeyException on duplicate key errors * [PHP-971] - Remove mongo.native_long for 32bit platforms * [PHP-990] - Implement Batch Write API ** New Feature * [PHP-819] - Add Mongo[DB|Collection]->[get|set]WriteConcern() * [PHP-831] - SASL Support (SASL Plain) * [PHP-832] - SASL Support (SASL Kerberos) * [PHP-861] - Add maxTimeMS() method to MongoCursor to configure the maximum time a query can take * [PHP-868] - Method to check if string is a valid ObjectId * [PHP-873] - Support the MONGODB-X509 authentication mechanism * [PHP-875] - Add support for cursor for aggregation * [PHP-876] - Make the driver check for the server version upon connection * [PHP-923] - Drivers should only talk to servers with overlapping wire versions * [PHP-944] - Support $out aggregation pipeline operator * [PHP-951] - Provide API for getting latest server version or isMaster response in driver * [PHP-962] - Create constants for additional binary data subtypes * [PHP-965] - Documentation for MongoId::isValid() ** Task * [PHP-657] - Add deprecation notice to MongoCursor::slaveOkay * [PHP-714] - Convenience macro for getting mongoclient* * [PHP-786] - Sort out includes * [PHP-809] - Deprecate use of "safe" all over collection.c * [PHP-844] - driver must authenticate before calling isMaster() * [PHP-845] - Ability to use different SPN on the driver for Kerberos Authentication * [PHP-983] - Change nUpdated to nMatched in bulk api results ** Sub-task * [PHP-763] - Create prototypes for MongoClient and Mongo classes * [PHP-794] - Remove 'fd' property of MongoCursorException * [PHP-797] - Deprecate public properties * [PHP-798] - Rename "timeout" to "socketTimeoutMS" in $options * [PHP-804] - Deprecate Mongo::connectUtil * [PHP-818] - Deprecate "Mongo" in favour of MongoClient. * [PHP-824] - Deprecate the "wtimeout" option in crud operations for wTimeoutMS

Simon Holywell: HHVM vs Zephir vs PHP: The showdown

PHPDeveloper.org - Mon, 03/03/2014 - 20:38

Simon Holywell has posted what he calls a "showdown" between HHVM, Zephir and PHP comparing various benchmarks (based on a Mandelbrot Set fractal).

Since its inception the slow running speed of PHP has been widely publicised and over the years there have been a number of improvements. [...] It has become more interesting recently however with three projects looking for improvements in different ways. The core has adopted the Zend OPcache for future versions of PHP, Facebook has been working on a just in time compiler called HipHop VM and the team that brought us Phalcon framework have created Zephir.

All of these projects have chosen to tackle the issue of PHP's speed via different avenues. It has therefore left one simple question - who's making the biggest improvements? Who's the fastest?

He briefly introduces the "contenders" for those not familiar with them and gets right into the benchmarking process. He shares the link to the tests he used and a few notes about the HHVM setup that could account for lower numbers. He shares his results in a few graphs or you can grab the CSV data yourself and parse it. The entire setup is also over on GitHub if you'd like to just check that out.

Link: http://simonholywell.com/post/2014/02/hhvm-vs-zephir-vs-php-the-showdown.html

SitePoint PHP Blog: Installing PHP Extensions on Nitrous.io

PHPDeveloper.org - Mon, 03/03/2014 - 19:45

On the SitePoint PHP blog Bruno Skvorc has posted a new tutorial showing you how to get PHP extensions installed on Nitrous.io, an online environment combining an IDE and PaaS hosting.

Inspired by a comment on my previous article, I realized Nitrous was still a bit too complicated to customize properly. In this tutorial, we'll glide through installing cURL and Phalcon on a Nitrous.io PHP box.

He continues on from his previous article and shows how to detect cURL support and how to build it from the PHP source into an extension. He helps you get the source for the older PHP version Nitrous.io has installed and the commands you'll need to build the extension. With it installed and enabled in the php.ini, he also installs the Phalcon extension.

Link: http://www.sitepoint.com/installing-php-extensions-nitrous-io

Ross Tuck: Persisting Value Objects in Doctrine

PHPDeveloper.org - Mon, 03/03/2014 - 18:11

Ross Tuck has submitted a new article he's posted about persisting value objects in the popular PHP database storage and object mapping library, Doctrine. Value objects are immutable objects that " follow value semantics rather than reference semantics".

I've been using more and more Value Objects in my applications over the last year, primarily with Doctrine ORM. Value Objects are an extremely powerful technique and I've been impressed with how much they can clean up a codebase. One of the main questions I've had when starting with Value Objects is how to persist them with Doctrine. This post attempts to create a reference for all the different persistence techniques I've seen so far.

You'll need to be familiar with Value Objects and Doctrine before starting (it's not an "intro to Doctrine" article). His example sets up an "IPRange" and an "IPAddress" that are stored in a "Server" instance. He talks about mapping the value object to the database and the getter/setter to do the work. He also touches on DBAL types, working with multiple columns in the entity and the "promised land" of embeddables. He finishes off the post looking at collections of entities and some of the other options to what he's shown (including serialization).

Link: http://rosstuck.com/persisting-value-objects-in-doctrine/

/Dev/Hell Podcast: Episode 40: Poly Life Mentoring

PHPDeveloper.org - Mon, 03/03/2014 - 17:16

The /Dev/Hell podcast, hosted by PHP community members Ed Finkler and Chris Hartjes, has released their latest episode - Episode 40: Poly Life Mentoring.

The big four-oh hits us, this time with our special Fictive Kin friend Sean Coates. We talk lots about deploying web applications in various languages, the impact Composer has had on PHP development, formal and informal mentoring, and how to get accepted to speak at conferences.

They also talk about a wide variety of other subjects in this edition including RVM+Bundler, Composer+Packagist, Flash, PHPMentoring.org and Webshell. You can listen to this latest episode either through the in-page player or by downloading the mp3 directly. If you like what you hear, consider subscribing to their feed for more great episodes.

Link: http://devhell.info/post/2014-02-28/poly-life-mentoring/

Community News: Packagist Latest Releases for 03.03.2014

PHPDeveloper.org - Mon, 03/03/2014 - 16:09
Recent releases from the Packagist:

Community News: Packagist Latest Releases for 03.02.2014

PHPDeveloper.org - Sun, 02/03/2014 - 16:03
Recent releases from the Packagist:

Community News: Packagist Latest Releases for 03.01.2014

PHPDeveloper.org - Sat, 01/03/2014 - 16:08
Recent releases from the Packagist:

SitePoint PHP Blog: Debugging with Xdebug and Sublime Text 3

PHPDeveloper.org - Fri, 28/02/2014 - 19:10

The latest post from the SitePoint PHP blog, a new tutorial by Peter Nijssen, shows you how to get started with Xdebug and Sublime Text 3 to debug your PHP applications.

Debugging - we all do it a lot. Writing code perfectly the first time around is hard and only a few (if any) succeed at it. More than a year ago, Shameer wrote an article on SitePoint about how you can debug your application using Xdebug and Netbeans. In this article, we are going to have a look at how we can debug using Xdebug in combination with Sublime Text.

He assumes you already have Xdebug installed (and links to the instructions for those that don't) and helps you configure it to find your listening editor. Back in Sublime, he shows you how to use the package manager to install the Xdebug client and configure the current project to use it. He shows how to set up breakpoints and view the stack/watch data when the point is hit.

Link: http://www.sitepoint.com/debugging-xdebug-sublime-text-3/
Syndicate content