PHP Community
Mattias Geniar's Blog: php_value vs php_admin_value and the use of php_flag explained
In this quick post to his blog Mattias Geniar looks at three different Apache flags you can use in your configuration/.htaccess files to set various things in your PHP environment.
Back in 2009 there was a bug in the php_admin_value implementation before PHP 5.2.6. Since then, everything should run smoothly again. However, I find there's still a lot of confusion on when to use php_value, php_admin_value, php_flag and php_admin_flag. So I'll see if we can clear some of that.He compares the three php_* flags you can use to set different kinds of values - "php_flag" for boolean operations, "php_admin_flag" (similar, but only in the vhost config) and the "php_value" that can be used for everything else, including overriding some settings in your php.ini.
NetTuts.com: PDO vs. MySQLi: Which Should You Use?
On the NetTuts.com site today there's a quick tutorial comparing two of the main database access methods available to PHP developers - PDO and MySQLi - based on performance and features they each have.
When accessing a database in PHP, we have two choices: MySQLi and PDO. So what should you know before choosing one? The differences, database support, stability, and performance concerns will be outlined in this article.The article starts with a summary of what each of the tools offers as far as features, things like the API to work with the interface, difficulty of making connections, use of prepared statements and performance. This is followed by a few code examples showing the same actions on each side:
- Making a new connection
- Databases supported (PDO has drivers)
- Named parameters
- Object mapping
- Security
- Performance
Dzone.com: A Free Amazon EC2 Cloud Server Based LAMP
In this new article on DZone.com, Artur Mkrtchyan shows you how to get an Amazon EC2 instance up and running and get a LAMP server set up and ready to go.
In this article I'm going to show you how to create a free Amazon EC2 cloud based LAMP Server and Point your domain to Amazon EC2 Instance. There are 4 simple steps to do.The setup process is pretty easy - getting an Amazon free account, creating a server from an existing image, installing the LAMP stack and pointing your domain at the EC2 instance. He gives a step-by-step guide of the process, including the commands you'll need to execute to get all of the LAMP packages installed.
Dave Marshall's Blog: How I'm designing a RESTful(ish) web service
Dave Marshall is in the process of building a "RESTish" web service and has shared some of his planning steps in a new post to his blog.
This post is going to describe how I've ending up designing, what I consider to be a fairly RESTful web API. I'm far from being an expert, and this is definitely the closest thing to a RESTful API that I've ever created, so I'm not even experienced with REST APIs. [...] Until about 6 months ago, I'd always been sceptical of creating RESTful APIs, but I think I've had a few pennies drop since then that have made me fairly confident that I grasp the basics pretty well.He touches on topics like: authentication, the Richardson Maturity model, HTTP verbs, sample request and response messages and some BDD-style tests to predict the output of a basic request.
Community News: Dutch PHP Conference Schedule Announced!
The Dutch PHP Conference has officially announced their schedule for this year's event and the opening of the registration (Early Bird pricing ending April 1st).
We are happy to announce that we have just published the schedule and registration is now open. Quickly, go and check out all the great content we have to offer this year! Once you've decided that you want to join us, you can go to the registration page to order your tickets. Please note that you will get a 15% early bird discount if you order your tickets before 15th April. Ticket prices were announced last week and can be found in this blogpost.Topics in this year's event include:
- Testing with Behat
- Zend Framework 2
- Backbone.js
- OAuth
- Elastic Search
- RESTful web services
- Puppet
- Coding/deploying/scaling with Amazon AWS
You can get your tickets on their registration page with the early bird pricing for all tickets lasting until April 1st. When ordering the full pass or tutorial-only, you will be asked to specify the tutorial you wish to attend.
Speaking at DPC12 & a Lone Star PHP Update
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!
Community News: The Great Web Framework Shootout
Seth Davis has put together a github repository with some benchmarking for some of the most common web frameworks - both PHP and not. His statistic is "requests per second" in a few scenarios: a "hello world" string test, a test with a database connection and one with a templated response.
It should also be noted that my goal here was not necessarily to figure out how fast each framework could perform at its most optimized configuration (although built-in caching and other performance tweaks were usually enabled if the default configuration permitted it), but rather to see what a minimal "out-of-the-box" experience would look like.Current results (as summed up in the current README) are for frameworks that include:
- Pyramid (Python)
- Django (Python)
- Sinatra (Ruby)
- CodeIgniter (PHP)
- Yii (PHP)
- Symfony (PHP)
Marcelo Gornstein's Blog: Sniffing in PHP using libpcap: Thank you SWIG!
Marcelo Gornstein has posted a new article showing how to use SWIG and libpcap to sniff packets from the network directly from his PHP application.
I've been wanting to try SWIG for a long time, but never got the chance, for one thing or the other. So this weekend I've finally decided to give it a try by trying to create a php extension that access a small C++ wrapper for libpcap, so I can sniff packets directly from PHP. Just for fun (and actually because I couldn't find any active pecl extension to use libpcap, so it might as well be something useful). I've named it "SimplePcap".He includes both the sample code showing the extension's usage and an example of the output from his local "eth0" device. His PHP script uses SWIG to interface with the pcap_t/Packet class structure via this interface file and typemap.
SWIG is really great. I just did some C++ code and then worried about how to integrate it to PHP. Althought it seems that you really need lots of experience with it to actually do more advanced things in the right way. [...] So I guess that sometimes it's more productive to just make the PHP extension than using SWIG. But if you want your code to be run in many languages, this is definitely an excellent library to try!PHPMaster.com: Creating Web Services with PHP and SOAP, Part 1
On PHPMaster.com today there's a new tutorial posted, the first part in a series, showing how to create SOAP web services with the help of the NuSOAP library.
In this first of a two part series on web services I'll talk about the SOAP specification and what is involved in creating SOAP messages. I'll also demonstrate how to create a SOAP server and client using the excellent NuSOAP library to illustrate the flow of SOAP. In the second part I'll talk about the importance of WSDL files, how you can easily generate them with NuSOAP as well, and how a client may use a WSDL file to better understand your web service.He introduces you to the concepts behind SOAP, the normal structure of a SOAP-formatted XML message and what an example might look like for fetching a stock price from a remote service. He then shows how to use NuSOAP to create both a simple server and client to pull information about books - sample code and a screenshot of the output is included.
Voices of the ElePHPant: Interview with Matthew Weier O'Phinney
On the Voices of the ElePHPant podcast today Cal Evans has posted the latest interview with a member of the PHP community. This time it's Matthew Weier O'Phinney, lead on the Zend Framework project.
Cal's "three questions" for Matthew were:
- Since Zend Framework is the opposite of the ideals behind the Micro PHP Manifesto, what are your thoughts on it?
- Zend Framework 2 is close but not done - should a new project go with v1 or v2?
- What's your local user group and it's URL (hint: there's not one yet)
You can listen to this latest episode either via the in-page player, by downloading it directly or by subscribing to their feed.
Community News: Latest PECL Releases for 02.21.2012
Nelm.io Blog: An Update On Composer
On the Nelm.io blog today there's an update about Composer, the PHP package manager that's been steadily growing in popularity over the last few months.
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.Their updates include mentions of:
- Changes to the "dev" version handling
- Major bugfixing in the dependency resolver
- More project documentation
- GitHub integration with Packagist (allowing you to directly update the Packagist site when you push a new version)
- A cleanup on the repository creation process (see here)
PHPMaster.com: WordPress Plugin Development
On PHPMaster.com today there's a new tutorial showing how you can create a custom WordPress plugin for the popular PHP-based blogging/CMS tool.
If you've ever used WordPress to build a site quickly, chances are you've used one of the many plugins that are offered to extend the functionality of this popular blogging software. Plugins are one of the many things that make WordPress so attractive. [...] There are times, however, when you can't quite find what you need from existing plugins. This article will show you how to create your own WordPress plugins by walking you through an example to display some text using a widget in a the sidebar.He walks you through all of the steps you'll need to create the plugin - making the main plugin file (definition) and using some of the methods available to create the functionality: update, form, widget and the constructor to set it all up.
Rob Allen's Blog: What problem does dependency injection solve?
In his latest post Rob Allen seeks to answer the question "what problem does dependency injection solve?":
Zend Framework 2 comes with a dependency injection container (DIC), as does Symfony 2 and Aura, along with many other PHP frameworks that target PHP 5.3 or hight nowadays. This article attempts to explore the problem that a DIC tries to solve.He gives an example (somewhat based on the same structure of his Zend Framework tutorial) showing how you could use DI to inject the Artist object into the Album object. This allows for more flexibility if more Artist types are added (extending the main Artist, of course). His second example shows how to use a DIC to hold album information.
7php.com: Interview with Chris Hartjes - The "Grumpy Programmer" of the PHP Community
7php.com has posted their latest interview with a member of the PHP community - Chris Hartjes, the "grumpy programmer".
In this edition I talked with Chris Hartjes (@grmpyprogrammer), the co-organizer of the GTA PHP User Group (@gtaphp). Chris is a real Grumpy PHP Programmer! But grumpy in a very positive sense though. He focuses his effort in applying and transcending his best practice ideals with the codes he write. I would tag him as the "perfectionist programmer"; he will not hesitate to scrap his piece of work if he finds a fault or a room for improvement and start all over again with that "eye for perfection". In this interview, he will talk a bit about those coding best practices fortunately.Chris answers questions about:
- His history with PHP
- His favorite PHP book
- What tools he uses (IDE)
- His description of the PHP community
- His favorite conference
You can read the answers to these and more in the full interview.
Community News: Latest PEAR Releases for 02.20.2012
An Update On Composer
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 handlingThe 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 stabilityNils 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.
DocumentationIgor 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 integrationAnother 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 configurationIt 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.
10 Reasons Why I’ve Switched From Netbeans To Sublime Text 2 For PHP Development
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?
- 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.
- 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?
- 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)
Symfony Blog: Symfony Live 2012: Paris Edition
On the Symfony Community Blog Fabien Potencier has officially announced Symfony Live 2012: Paris Edition, a Symfony-focused event that will take place in June.
Today, I'm excited to announce the fourth Symfony Live Conference in Paris. It will take place on June 7-8th; Paris in the Spring is a lovely city! Like last year, we will have two parallel tracks and the conference will be held in English (with probably a few sessions in French). The call for papers is open until March 30th; if you want to share your real-life Symfony experience, consider submitting a session proposal (SensioLabs covers travel and accommodation expenses for foreign speakers.)As in years before, there will be an unconference and Symfony training sessions will be on the day before the event (the 6th). Tickets are already on sale so if you're interested in attending or just want more information about the event, check out the main conference website.