News Feed
Sections




News Archive
feed this:

Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Paul Jones:
PSR-4 "Autoloader" Has Passed
December 04, 2013 @ 10:37:51

As Paul Jones mentions in his latest post, one of the latest proposals to the PHP-FIG (Framework Interoperability Group) has officially passed, PSR-4, providing a more strict standard for autoloading than the widely used PSR-0.

Counting from the date of that first formal proposal, it has taken exactly 8 months of discussions, one botched vote, one rescinded vote, an entirely new FIG workflow, and four or five rewrites to get PSR-4 passed. Maybe 8 months doesn't sound so long when you look back on it, but while you're in the middle of it, it's interminable.

Paul talks about some of the differences between it and PSR-0, making for "shallower" and more concise directory structures for packages. He also points to some of the packages from the Aura framework as examples of its implementation.

0 comments voice your opinion now!
psr4 autoloader phpfig proposal vote pass directory structure namespace

Link: http://paul-m-jones.com/archives/4804

Community News:
PSR-4 Autloader Proposal now in Draft Status
August 23, 2013 @ 12:05:41

As is mentioned in this Reddit post, the PHP-FIG group has moved a new autoloader structure proposal into "Draft" status, making it past the initial proposal (Entrance Vote) level as PSR-4.

This new autoloader has been in the works for a while, and is meant to be a modern autoloader that reflects the changes in the PHP landscape since PSR-0 was originally put together. Yesterday it passed the Entrance Vote, which means its now a formally worked and supported by the FIG.

While PSR-0 is new to many, its been around for years - since before Composer was really a thing - and PEAR/SF1/ZF1 were the prominent sources of distributed code. Now that so many are building components with Composer and using PSR-0 (yay) it's about time a new standard took care of a few hangovers from the PEAR/Zend style.

The newly proposed autoloader gets rid of some of the allowances that PSR-0 included like proper namespace support (no more underscores) and a reduction in the required folder structure to make it work. The Composer project is also a part of these discussions and are on board with making these proposed changes in the project's autoload handling.

We'd love to get constructive feedback on PSR-4. Post stuff up here, on the mailing list, get in #phpfig on freenode, whatever, just get involved. That doesn't mean everything will be implemented, but there is more chance of the standard containing your feedback if you make it - so post something.
0 comments voice your opinion now!
phpfig psr4 autoloader draft vote composer namespace directory

Link: http://www.reddit.com/r/PHP/comments/1kvr1f/the_new_autoloading_standard_psr4_passes_entrance

Lingohub.com:
PHP internationalization with gettext tutorial
July 17, 2013 @ 09:41:37

On Lingohub.com there's a recent tutorial posted about using gettext for the internationalization of your application. The gettext functionality lets you define POT files (portable object templates) that contain the strings for the given language.

GNU gettext is a package that offers to programmers, translators and even users a well integrated set of tools that provide a framework within which other free packages may produce multi-lingual messages. [...] In this tutorial we want to document how PHP internationalization with gettext works. It covers setup, use and best practice.

They go through the installation of both the gettext software and how to get support for it built into PHP. There's a detailed guide to creating the POT files and the formatting you can use to define things like simple messages, plurals and multiple response messages. An example file is included to illustrate. They also talk about the directory structure to use and how to get it working in PHP (sample code).

0 comments voice your opinion now!
gettext tutorial install configure pot file directory

Link: http://blog.lingohub.com/2013/07/php-internationalization-with-gettext-tutorial

Rob Allen:
Thoughts on module directory structure
January 04, 2013 @ 09:09:55

Rob Allen, in his Zend Framework 2 development, has come up with a list of suggestions about the use of modules in your applications, mainly relating to the structure of the files inside of them.

I've been working on a Zend Framework 2 module within a larger project that doesn't have that many PHP class files. Specifically, it has a controller, a mapper, an entity, a service and a form. As a result, the traditional Zend Framework 2 directory structure for the Account module looks [overly complicated]. That's a lot of directories for not many files! As a result, I decided to flatten it to [something simpler].

He includes both the "before" and "after" directory structures and continues on with two more suggestions - the removal of the top level "Account" folder inside of "src/" and, finally, removing "src/" all together with a slight modification to the autoloading. With a simpler module, though, something like this might make it easier to maintain and "follow" later down the road.

0 comments voice your opinion now!
zendframework2 module structure directory minimal


PHPMaster.com:
List Files and Directories with PHP
October 23, 2012 @ 08:56:25

On PHPMaster.com there's a new tutorial showing you how to work with files and directories through your PHP applications.

In this article I'll talk about a common task you might have experienced while developing a PHP application: listing files and directories. I'll discuss several basic and advanced solutions, each having its pros and cons. First I'll present three approaches that use some very basic PHP functions and then progress to more robust ones which make use of SPL Iterators.

The solutions they look at are the built-in functions like glob and readdir/opendir as well as SPL iterators up for the task - FilesystemIterator, RecursiveDirectoryIterator and GlobIterator. Code samples are included in the post, showing how to use each method to get and list the files. A few helpful hints are also included to finish off the tutorial (mostly about "tricks" to using the functions effectively).

0 comments voice your opinion now!
tutorial file directory list spl iterator


PHPMaster.com:
Using SPL Iterators, Part 1
May 15, 2012 @ 12:26:59

On PHPMaster.com today there's a new tutorial posted, the first part of a series, looking at the use of the Standard PHP Library (SPL) in PHP. In this first part of the series, Stefan Froelich looks specifically at two of the more common uses for iterators - working with arrays and directories.

When I first came across the term iteration and saw the overwhelming list of classes related to it in the SPL, I was taken aback. It seemed maybe iteration was too complex for me to grasp. I soon realized it was just a fancy word for something we programmers do all the time. [...] In the first part of this two-part series I'll introduce you to iteration and how you can take advantage of some of the built-in classes from the Standard PHP Library (SPL).

Included in the tutorial is example code showing how to use the ArrayIterator to work with an array and the DirectoryIterator to process the contents of a directory. He also briefly touches on a few other iterators like "FileExtensionFilter", "RecursiveDirectoryIterator" and "RecursiveArrayIterator".

0 comments voice your opinion now!
spl iterators tutorial array directory file recursive


Job Posting:
Worldwide Travel Directory Seeks LAMP Consultant (New York City, NY)
September 15, 2010 @ 12:29:44

Company Worldwide Travel Directory
Location New York City, NY (Downtown)
Title LAMP Consultant
Summary

A worldwide travel directory is seeking a sharp and well-qualified LAMP consultant to work on an online reservation system. This is an outstanding temporary opportunity for a highly analytical IT professional with substantial e-commerce experience, to join a advanced and growing atmosphere! Please consider this position by applying today for immediate consideration.

NOTE: Position is contract but could become long-term/permanent for the right fit.

Company Description
Worldwide Travel Directory

Job Description
In this short-term, temporary position, the LAMP Consultant will work on an online reservation for a worldwide travel directory. Candidates must come from an e-commerce background and have 5+ years of programming experience with Linux, Apache HTTP Server, MySQL, and PHP.

Required Skills

  • 5+ years of programming experience with Linux, Apache HTTP Server, MySQL, and PHP
  • Substantial e-commerce experience
  • Excellent written and verbal communication skills
  • Strong ability to work autonomously
  • Highly analytical
  • Experience with all phases of application development from initial design through deployment
  • Ability to interpret and analyze existing code base

Desired Skills

  • Experience in developing mobile apps
  • Prior exposure to online booking and travel development. i.e. Expedia, Travelocity, or similar

    For more information or to submit your resume, contact Michael J. Pisano at MPisano@execu-search.com.

0 comments voice your opinion now!
job ny newyork lamp consultant travel directory job


Matthew Weier O'Phinney's Blog:
Applying FilterIterator to Directory Iteration
August 17, 2010 @ 10:29:38

New on his blog Matthew Weier O'Phinney has this post looking about using the FilterIterator (from PHP's SPL libraries) to work with (recursive) directory iteration.

I'm currently doing research and prototyping for autoloading alternatives in Zend Framework 2.0. One approach I'm looking at involves creating explicit class/file maps; these tend to be much faster than using the include_path, but do require some additional setup. [...] I'm well aware of RecursiveDirectoryIterator, and planned to use that. However, I also had heard of FilterIterator, and wondered if I could tie that in somehow. In the end, I could, but the solution was non-obvious.

He starts with what he thought he should be able to do with the FilterIterator - pass in a DirectoryIterator to be able to filter them recursively. Unfortunately this only worked for the first level, so he looked else where. His solution ultimately involved passing in a RecursiveIteratorIterator instance into the DirectoryIterator that contained his RecursiveDirectoryIterator. He includes a full code example in the post showing how to locate a certain file/class recursively inside a directory.

0 comments voice your opinion now!
iterator spl filteriterator directory tutorial


Rafael Dohms' Blog:
Iterating over life with SPL Iterators I Directories
October 08, 2009 @ 11:57:33

Rafael Dohms has posted the first part of a series he's writing looking at the Iterators that come with the Standard PHP Library (SPL). In this first article he focuses on Directory iterators.

Wouldn't it be nice if you could go by life just applying a foreach to each year and life day by day? Ok, that was an awful joke, but using iterators does make life a lot easier and fun, and that's without mentioning cleaner code. SPL's iterator classes are really awesome and helpful, replacing multiple lines of code and a handful functions with a simple new this and a foreach can really help cleaning up code.

He looks at both the DirectoryIterator and the RecursiveDirectoryIterator with code examples to go with each.

0 comments voice your opinion now!
spl iterator directory recursive


DevShed:
Using Directory Iterators to Build Loader Apps in PHP
July 06, 2009 @ 10:17:11

DevShed finishes off their "loader" series of tutorials today with this eighth part focusing on the use of Directory Iterators.

Here's where the SPL comes in, since it's possible to use a combination of its "spl_autoload_register()" function and its RecursiveDirectoryIterator class to refactor the method in question and make it shorter and tighter. In this final chapter of the series I'm going to improve the loader class developed in the previous one by incorporating some of the aforementioned SPL functions and classes.

They change up their code to use a RecursiveDirectoryIterator inside of their __autoload to remove their custom recursive code.

0 comments voice your opinion now!
tutorial autoload recursive iterator directory spl



Community Events





Don't see your event here?
Let us know!


developer podcast threedevsandamaybe list language configure laravel install code wordpress framework series interview testing introduction unittest experience opinion release community

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework