blog.phpdeveloper.org » PHPSpeaking at DPC12 & a Lone Star PHP Update (22.2.2012, 13:55 UTC)

Well, I’ve been a little lazy around here and haven’t posted since the beginning of the year. I figured I’d fix that by posting an update about a few things going on around here.

First off, since the schedule was just released, I’ll mention that I’ll be presenting at this year’s Dutch PHP Conference with three different sessions (well, kind of just two):

  • Agile Applications with ExtJS and Zend Framework
    ExtJS is an enterprise-level Javascript framework, the Zend Framework is one of the most powerful and flexible PHP frameworks to date – its a match made in heaven. I’ll introduce you to these two technologies and how to combine them into an easy to maintain, agile application that can move as fast as your project needs. I’ll show you how to build a sample application including a frontend MVC, REST backend and unit testing the result. (Tutorial)
  • The API Dilema
    Creating a good, useful and functional API for your application can be one of the most difficult parts of a project. With more and more things becoming API-powered, it’s important to plan well and provide what the user expects. I’ll look at some principles you can follow to make sure the API you write is the right one, both from the developer perspective and what you, as a user, should expect of a quality web service API. (Session)
  • Agile Applications with ExtJS and Zend Framework
    ExtJS is an enterprise-level Javascript framework, the Zend Framework is one of the most powerful and flexible PHP frameworks to date – its a match made in heaven. I’ll introduce you to these two technologies and how to combine them into an easy to maintain, agile application that can move as fast as your project needs. I’ll show you how to build a sample application including a frontend MVC, REST backend and unit testing the result. (Session)

No, I didn’t repeat myself – the first session and the last session are on the same topics – they’re just different lengths. The tutorial on the first day will get more into coding and examples of ExtJS+ZF and the second shorter session will just give a high level overview of each tool and how they hook together. If you’re interested in the “guts” of an Ext-based app, you’d do better in the Tutorial.

Also, for those that don’t know me, I’m a co-organizer of the Dallas PHP User Group. Last year we decided to put on a local PHP-centric event and it was a great success. So, we’re back this year with the Lone Star PHP Conference 2012. We’ve just wrapped up our Call for Papers and are in the process of selecting the best fits for our schedule.

We’ll be announcing the schedule and opening the registration soon, so keep an eye out on the Lone Star PHP conference site for more updates!

Link
NelmioAn Update On Composer (20.2.2012, 10:07 UTC)

This weekend we have been busy hacking on Composer in our office together with Nils Adermann and Volker Dusch. We wanted to push the project forward a bit faster than the odd free evenings usually allow, and I would now like to introduce the changes we made.

Development versions handling

The former master-dev and similar *-dev versions we used to have were causing quite a few issues, so we decided to overhaul that behavior in a way that allowed us to get more consistency and fix a few long standing issues. For example dev versions can now be locked to exact commit revisions, and they will update to the latest revision when you do an update, no need to delete them from disk beforehand.

Basically dev releases are now simply branch names with a dev suffix – for numeric branches which are comparable – or a dev prefix for textual names that are not comparable, like feature branches and master. There is no way to specify the version manually anymore in your repository’s composer.json, since that was causing potentially dangerous issues with feature branches conflicting with the original ones.

If your package depended on a master-dev version, you should now depend on dev-master. If your package depended on something like the Symfony2 2.1.0-dev version, this one also is now dev-master since it is in the master branch. Older feature branches like 2.0-dev which is the 2.0 branch and not master are unaffected by this change.

This change will break many packages out there that rely on -dev packages of any kind, and we hope everyone will update their composer.json files as swiftly as possible to make the transition less painful.

The Packagist version database had to be reset for this change, so things will look at bit empty for a couple of hours while everything is re-crawled. None of the packages are lost and you should not have to do anything except having a bit of patience.

Dependency solver stability

Nils and Volker have been doing big progress on bugfixing and testing the solver. Those are mostly highly technical details that I will not dive into here. But long story short many old bugs should be fixed, and then some. It may obviously have introduced regressions, so if you encounter any issues please report them with your composer.json file so we can easily reproduce.

Documentation

Igor has spent quite a bit of time on documentation, which you can see on github for now, and which should be migrated to getcomposer.org soon.

Packagist / GitHub integration

Another great new feature coming from a pull request by Beau Simensen is the ability to let GitHub tell Packagist when you push new code to your repository. This should make package updates almost instant. It should be integrated into the GitHub Service Hooks soon enough, so if you don’t want to set it up by hand you can wait a bit, otherwise you can grab your API hook URL on your Packagist profile page, and add it in your repository.

Repositories configuration

It seemed that the way custom repositories are configured was confusing, so we took the chance to make it a bit clearer. Basically names are dropped and it’s all stored in a flatter structure that’s easier to remember. Documentation has been updated on Packagist.

All in all it has been quite a productive week-end and we will continue working on a few things today.

Link
Stuart Herbert10 Reasons Why I’ve Switched From Netbeans To Sublime Text 2 For PHP Development (20.2.2012, 06:00 UTC)

I’ve recently switched from using Netbeans as my PHP dev tool of choice to Sublime Text 2. Features-wise, I think Netbeans is great. During the years I used it, I never felt that there was a feature I needed that was missing at the time. But, like all the current crop of Java-based desktop IDEs, it’s so damn ugly [1] and slow [2] that I’ve had enough. I program because it’s something that I love doing, and anything that gets in the way of that … I’ve no time for any more. So when a work colleague introduced me to Sublime Text 2, I was in the mood to give it a go, and 3 months on, I haven’t opened Netbeans once.

I’ll be the first to say that Sublime Text 2 isn’t for everyone.

  • It’s a beta product, which means there are some rough edges (mostly in the plugin API I feel), but it’s more than stable enough for production use. It has crashed a couple of times, which might put some people off, but I don’t recall losing any work as a result. File management in the project pane still needs work. The regular dev builds occasionally break things.
  • It isn’t a full-blown IDE; it’s more like the spiritual successor to TextMate, an editor that I never personally cared for. In particular, it doesn’t support interactive debuggers, which means no Xdebug support, and there’s currently no obvious way for a plugin to add that functionality in [3].
  • Auto-completion isn’t anything like what you’re used to. The built-in auto-completion is based on a mix of static knowledge of languages and fuzzy matching against what you’ve recently typed. There’s no obvious intelligence about the code you’re working on, nor the parameters for any method or function. These are two things that many people will deeply miss. [4]
  • It isn’t free, but you can evaluate it for free with no time limit. If you decide to buy, it’s substantially cheaper than both PhpStorm and Zend Studio, and there’s no annual subscription element to the licensing. You’re buying a license to support and encourage an independent developer, and to show your appreciation for a very nice piece of software.
  • It’s a closed-source product. You can’t fix it yourself if it breaks, and no-one can pick up the reigns if it gets abandoned. There seems to be just one guy behind it, and if anything happened to him, that’d probably be the end of the product. That said, most of the alternatives are also closed-source too.

Given all of that, why have I switched?

  1. Sublime Text 2 is very very fast. Sublime Text 2 itself opens instantly. Files open instantly (provided they’re not 100 megabyte test data files). In fact, everything happens instantly – even inside a virtual machine running on a 3 year old laptop. There are no pauses for anything to be indexed, and I’ve never seen CPU usage spike – important for us untethered users and our suffering laptop batteries [5]. And if a plugin slows things down at all, Sublime Text 2 tells you which one is the culprit so that you can go and disable it. I’d compare the importance of the speed difference to switching from a hard disk to an SSD. You don’t realise how much you’re waiting for your slow Java-based IDE until you use something that’s properly fast.
  2. It renders fonts properly – Droid Sans Mono and Ubuntu Mono in particular both look gorgeous – and even after a long day of use, my eyes don’t feel like they’ve been scratched on the inside by sharpened kitty claws all day long [6]. True story: one of my colleagues came over to ask what I was using, because he thought it looked so nice from a distance. When was the last time anyone ever thought that about a desktop Java app?
  3. All of the searching is based on an extremely powerful fuzzy matching approach. Netbeans supports regexes, which can be very handy, but most of the time when I’m looking for something, a regex is overkill but a simple string search isn’t powerful enough. If I’ve got both a class called ‘IpcProcess’ and ‘IpcProcessID’, in Sublime Text 2 I can find the ‘IpcProcessID’ class by searching for ‘ipi’; I just have to type the shortest set of characters that uniquely matches what I’m looking for. It’s much quick

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

Link
Gaylord AulkePlat_Forms 2012: Teams needed to represent PHP (17.2.2012, 10:13 UTC)

In 2007, the first Plat_Forms contest took place with support of Zend Technologies, University of Berlin, Heise Publishing Company and OSBF. It was a web development platform comparison like it had never been done before: 9 teams in controlled environment doing the same task in a limited time. During that time, the team of Prof. Lutz Prechelt collected data and after the contest, the results together with the data regarding the workflow of the individual teams was evaluated in a scientific way.

Back then, the PHP teams had outperformed Java and Perl in terms of development productivity and usability of the resulting applications. The results of this contests helped to position PHP in many large organisations because they proved common prejudices against PHP wrong: No, PHP is not insecure, no it is not slow, etc.

In 2011 a second contest was helt with 16 teams. Unfortunately the results were not that inspiring this time (as shown here some time ago). Now the third event of this kind is coming up:

Plat_Forms 2012 will take place on April 3rd and 4th, 2012 in Berlin, Germany.

Plat_Forms 2012 will focus on scalability and cloud computing. Unlike in 2007 and 2011, this year's teams will implement a highly scalable web service on Amazon Web Service infrastructure.

Again, multiple teams consisting of 3 persons each are invited for each web programming platform: PHP, Ruby, Perl, Java. They are searching for strong PHP teams with the will to compete.

PHP needs you! More information here.

Link
Maggie NelsonA while ago ago, I quit Flickr to work on a “social geo... (17.2.2012, 02:32 UTC)


A while ago ago, I quit Flickr to work on a “social geo mobile local” startup that was secret to everyone except some closest friends and family. Today, we are finally able to talk about it in public!

The great team at 2bkco is happy to announce Pinwheel (for now in private beta). Our fearless leader Caterina Fake has posted an introduction to what I think will be an awesome service for years to come.

If you’d like to leave some notes around the world for people to find, come on over to Pinwheel and sign up!

Link
Brandon SavageThe Mechanics Of Code (16.2.2012, 14:20 UTC)
Since the dawn of programming, programmers have attempted to define their industry, often by using outside industries for comparison. This can be traced back to the fact that programming itself is unique: it’s unlike any field in existence. Most programmers hate being called “coders”: it seems pedestrian, somehow beneath what we do. Many times we [...]
Link
Lorna MitchellUpcoming PHP Courses (16.2.2012, 08:36 UTC)

Since becoming freelance 18 months ago, I've taught a number of courses at my excellent local tech training centre, NTI Leeds. Over the next few months we're running some one-day PHP courses (see my course dates page for more detail and the dates, all these are in Leeds although I'd like to run them elsewhere too), targeted at a particular area or set of skills. These are areas that I find myself delivering consultancy or training on frequently, or things I teach when I go places and realise these gaps exist in their knowledge. Does this match your experiences of "things I wish PHP developers knew - including me"?

Design Patterns and OOP

I like design patterns and the joy of teaching this is that it helps to stop some of the big words and unfamiliar terms in object-oriented programming from seeming like rocket science. Most people will quickly tell me "oh, I've been using this all along!" - which is exactly the point :) Teaching a few design patterns also gives a great vehicle for teaching some of the advanced OOP concepts in a more interesting way than "this is an interface".

Databases and PDO

Web developers don't know what they don't know about databases! Being able to join multiple tables with different types of join and aggregate data correctly allows you to learn how to normalise data and not be afraid to implement the schema changes. I like to teach how to do this and get everyone confident with it all. The PDO extension is a fabulous way of working with databases and I think the prepared statements are in everyone's interests, so that forms a good part of the course too.

PHP Tools

A course for all the allied skills you need - configuring apache, a bit of linux command line, quality and performance tools (xhprof, php code sniffer, api documentation, and more) are all included. There's a splash of source control (because it is the basis of all things!) and we also talk about strategies for deployment (with phing as an example) and managing things like configuration management and database schema changes. In a one-day course there isn't time to teach unit testing or continuous integration properly but they do get a mention and I try to point interested parties in the right direction for more information.

PHP Courses

If any of the above sound interesting and you want to come and learn this stuff with me for a day, you can book the courses through NTI. Feel free to ping me with questions, comments, or tell me why this isn't the right topic for you - always interested to hear others' viewpoints.

Lorna is an independent web development consultant, writer and trainer, open source project lead and community evangelist. This post was originally published at LornaJane

Link
Chris ShiflettSpeaking at Boston PHP (14.2.2012, 19:54 UTC)

If you're going to be in or around Boston tomorrow (Wednesday) night, I hope you'll join me at the Microsoft NERD Center, where I'll be giving my first talk in more than a year and a half.

I'm going to be speaking about the science of human behavior and why perception matters, even if all you care about is something like security. This talk is a lot of fun, because I mostly just talk about stuff that I find really interesting. There are more videos than bullets, and more science than code.

After the talk, I have it on good authority that we'll be enjoying stimulating conversation and drinking good beer.

Click here to RSVP.

Link
Matthew TurlandWordPress SyntaxHighlighter font size fix (14.2.2012, 02:41 UTC)

I use WordPress for this web site. To pretty up source code examples in my posts, I use the excellent SyntaxHighlighter Evolved WordPress plugin. The WordPress theme I use, Fluid Blue, does something with its CSS such that it and SyntaxHighlighter appear to conflict. The result is that source code examples processed by the plugin are displayed with a font size that’s too small to read comfortably.

In doing some digging, I learned about the child themes feature of WordPress, which allows you to effectively extend an existing theme. I created a directory under wp-content/themes called fluid-blue-custom. In this directory, I created a styles.css file with these contents:

/*
Theme Name: Fluid Blue (Custom)
Template: fluid-blue
*/

@import url("../fluid-blue/style.css");

body .syntaxhighlighter code, body .syntaxhighlighter .gutter { font-size: 12px !important; }

The Template line of the comment block indicates that this theme is a child theme of the existing Fluid Blue theme that resides in the wp-content/themes/fluid-blue directory. The @import line pulls in the styles.css file from that directory, after which I can apply any CSS overrides I like. The last line is a CSS rule specific enough to override applicable rules from the parent theme in order to increase the font size to something more easily readable.

It appears I’m not the only one who’s encountered this issue, so I hope this post helps someone else.

Link
Matthew TurlandSetting up EC2 for Drupal with Puppet (14.2.2012, 00:29 UTC)

I’m currently working on a project that involves running Drupal on Amazon EC2. To save time in setting up future new VM instances, I decided to take the opportunity to learn puppet. For the time being, I’m using a single VM to run the full LAMP stack and running puppet without a server by copying my puppet manifest to the VM and using puppet’s apply command to apply it locally. However, this manifest can easily be adapted for a multi-VM environment. After some tinkering, I came up with the code below.

class web {
    package { 'httpd':
        ensure => 'present',
    }

    package { 'php':
        ensure => 'present',
    }

    # Update this to use your respective time zone value
    exec { 'php_config':
        command => '/bin/sed -i "s/^;date.timezone =/date.timezone = \'America\/Chicago\'/g" /etc/php.ini',
        require => Package['php'],
    }

    service { 'httpd':
        ensure => 'running',
        enable => true,
        hasrestart => true,
        hasstatus => true,
        subscribe => Package['httpd', 'php'],
    }

    # Drupal requirements
    package { ['php-pdo', 'php-mysql', 'php-xml', 'php-gd', 'php-mbstring']:
        ensure => 'present',
        require => Package['php'],
    }
}

class mysql {
    package { 'mysql-server':
        ensure => 'present',
    }

    service { 'mysqld':
        ensure => 'running',
        enable => true,
        hasrestart => true,
        hasstatus => true,
        subscribe => Package['mysql-server'],
    }

    # Equivalent to /usr/bin/mysql_secure_installation without providing or setting a password
    exec { 'mysql_secure_installation':
        command => '/usr/bin/mysql -uroot -e "DELETE FROM mysql.user WHERE User=\'\'; DELETE FROM mysql.user WHERE User=\'root\' AND Host NOT IN (\'localhost\', \'127.0.0.1\', \'::1\'); DROP DATABASE IF EXISTS test; FLUSH PRIVILEGES;" mysql',
        require => Service['mysqld'],
    }
}

class {'web': }
class {'mysql': }

With this code saved to a file called manifest.pp (.pp being the file extension for puppet manifests), I can spin up a VM and do the following to set it up:

scp -i key.pem manifest.pp ec2-user@host:~/
ssh -i key.pem ec2-user@host
sudo yum upgrade -y
sudo yum install -y puppet
sudo puppet apply manifest.pp
rm -f manifest.pp
exit

At this point, I have a basic Apache/MySQL/PHP configuration capable of receiving a Drupal 7 installation.

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