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

Alejandro Celaya:
Working with sub-namespaced modules in Zend Framework 2 the right way
Aug 20, 2015 @ 10:56:26

Alejandro Celaya has a post showing how he recommends working with sub-namespaced modules in a Zend Framework 2 application. It's based on a previous series of articles on the same topic but improves the methods for handling.

The solution provided in those articles was functional, but it introduced some new problems to deal with. It happens that after some time working with sub-namespaced modules I have found the best way to solve those new problems, and I wanted to write this new article explaining it.

He starts with the two main problems with the use of sub-namespaced modules: the autoloading of the module's files and how it resolves the locations of view scripts. Fortunately, the solution to both issues turns out to be "really easy". Composer's autoloading means that just changing the directory structure helps there and and update to the controller_map value helps with locating view files.

tagged: subnamespaced modules zendframework2 autoload view script location

Link: http://blog.alejandrocelaya.com/2015/08/14/working-with-sub-namespaced-modules-in-zend-framework-2-the-right-way/

Community News:
PHP-FIG Proposal - Resource Location
Jun 19, 2013 @ 10:55:29

A new proposal has been made to the PHP-FIG group that would provide resource locator functionality as a standard part of an application's structure.

This specification proposes to refer to files and directories through URIs. [...] These URIs can have different schemes ("classpath", "file" etc.), but only the scheme "file" is specified in this document. The resource locator is able to turn URIs into file paths which can be read or included by PHP code. The general goal of this PSR is to locate files (PHP, XML, YAML, INI, JPG, etc.) and directories in a generic way. For example, there should be a unified notation to refer to the file of a class ABCD and other files located in the same directory (or nested directories).

Code snippets are included showing a pseudo-code interface to this locator with five requirements:

  • Locate files relative to classes
  • Locate both directories and files
  • Short identifiers when the context is known
  • Locate resources independent from PHP classes
  • Support resource overriding

There's also some definition as to what is meant by a "resource location" and how the URIs should be structured and located.

tagged: phpfig proposal resource location framework interoperability standard psr

Link: https://github.com/bschussek/fig-standards/blob/master/proposed/resource-location.md

PHPMaster.com:
Targeted Geolocation with Geonames
Dec 13, 2011 @ 12:10:02

New on PHPMaster.com there's a tutorial from Lukas White about targeting users using geolocation based on the Geonames web service and a latitude/longitude. His example makes a call to find the closest "place" to the given coordinates.

Location-aware applications rely on being able to locate where you are, and this is what geolocation is all about. After all, once the application knows your location, it can go on to find the nearest store, guide you through the appropriate route to a destination, or target relevant advertisements to you. Geolocation, then, is simply the mechanism for identifying your geographical location.

He mentions two challenges associated with geolocation - finding where someone is and describing the location. With Geonames, he shows how to call the service's "findNearbyPlaceName" method to find the closest "place" to a given latitude/longitude combination. Included is a bit of sample PHP to connect to the service and Javascript to request the user's current location.

tagged: geolocation tutorial geonames webservice json location

Link:

Stuart Herbert's Blog:
Where Do You Get Your PHP From For Windows?
Sep 29, 2011 @ 10:58:24

In a recent post to his blog Stuart Herbert asks his readers where they get their Windows PHP binaries from - there's more than just windows.php.net out there after all.

I’m currently working out installation instructions for phix on Microsoft Windows before my sessions at PHPNW 11 and ZendCon in October...and I need your help, because it has been many years now since I used Windows. If you do your PHP development using Windows on the desktop or laptop, where do you prefer to get your copy of PHP from?

He offers a few options: the obvious windows.php.net, the Microsoft Web Platform or a package like XAMPP/WAMP. In the comments of the post favorites include the Web Platform Installer and windows.php.net with the package versions (XAMPP/WAMP) coming in behind.

tagged: windows install location repository xampp wamp webplatform windowsphpnet

Link:

Community News:
Dutch PHP Conference - Important update: Conference Social Location has Changed!
May 02, 2011 @ 13:40:28

If you're attending this year's Dutch PHP Conference, they've just posted an important announcement about the conference social:

The conference social will now take place at a venue called ClubNL, which is also in central Amsterdam and within easy walk from the Amsterdam main train station. Please remember to hold on to your conference badge, as you will need it to gain access to the event. For more details check out the updated social page on our website. We are hoping to see you all there!

There's still time for you to get your tickets to this great event happening in a few weeks (May 19th-21st) in Amsterdam - full event tickets run 695 Euro and the single-day tickets (just tutorial or just conference day) are 375 Euro. Get yours today!

tagged: dpc11 conference social event location change clubnl

Link:

LifeHacker.com:
Synchronize Google Voice with Your GPS Location
Mar 01, 2010 @ 13:28:49

On LifeHacker.com there's a tutorial on how you can use a simple PHP script running on a remote server to tell Google Voice which is the best phone to forward your calls to. The method requires the use of an Android phone, though.

I figure the only way Google Voice could be improved is if it magically knew where I am and made my phones ring accordingly—so that's exactly what I made it do. You can, too, with an Android phone, the Locale app, and a web server. The overall goal: have Google Voice know which phones to ring, based on your current location or situation.

You'll need a Google Voice account (obviously), some software for your phone and a remote web server running PHP 5 (with cURL and json functionality). You can then use the PHP script by passing parameters as to which phones to turn off and on and use the Locale tool to create the "situations" where it needs to make the switch.

tagged: syncronize googlevoice gps location tutorial locate

Link:

PHPClasses.org:
PHP User Group Listing (and Rank)
Jan 14, 2010 @ 10:09:41

On the PHPClasses.org blog today there's a new post from Manuel Lemos looking at user groups - how to keep them alive and what you can do to rekindle a faltering group.

PHP was spread by its users. Over time PHP user groups have been doing an extraordinary job in promoting the PHP communities everywhere, so local PHP users get more support in their local idiom and progress faster in their careers as PHP developers. Many PHP user groups organize meetings and events that help PHP users learning more and make valuable contacts that they often use to get in touch with more experienced and helpful PHP developers.

He mentions a big challenge for keeping groups alive - leadership shifts and dwindling membership - and something the PHPClasses site offers to help advertize groups all around the world. If you're looking for a group in your area (most of the coverage seems outside of the US right now) try their user group directory.

tagged: usergroup list location

Link:

php|architect Blog:
Miami, Washington/Baltimore and New York City CodeWorks 09 Locations Announced
Jul 22, 2009 @ 12:09:59

If you've been planning on attending either the Miami, Washington/Baltimore or New York City stops of the CodeWorks 2009 conference, you'll be happy to know they've announced the venues for each of the locations.

We're happy to finally be able to announce the CodeWorks 09 locations for our Miami, Washington/Baltimore and New York City locations—and, in case you were waiting to find out where each event was going to take place, we're extending the early-early-bird special all the way to July 31st!

Here's the list of locations:

  • New York will be at the New York Marriott Brooklyn Bridge
  • Washington/Baltimore will be at the Embassy Suites Old Town Alexandria
  • Miami will be at the Hilton Miami Downtown Hotel

You can get more information about the conference (including how to register - the Early Bird special is still going) from the main conference website.

tagged: location newyorkcite baltimore washington miami cw09

Link:

Zend Developer Zone:
Location, Location, Location
Jun 02, 2009 @ 09:39:03

In a new tutorial on the Zend Developer Zone, Sam reminds us that, sometimes, it's all about "Location, Location, Location" with Zend Framework applications.

I was having a conversation with a client recently on the topic of best practices. He asked me: "Where should I put the Zend Framework source code?" This is an excellent question that can not only be applied to Zend Framework, but to similar frameworks also. The question has in fact two answers in my opinion, which answer is right for you depends on how you answer this question.

He answers the question by asking a question of his own - is ZF part of your application or of your environment? There's (basically) two different paths to follow here and that question is the branching point. If its in the app, he recommends keeping it closely tied and in the "/library" of the app. If not, then it's recommended to place it out where multiple applications could get to it.

There's also third option, hybrid of the two that allows you to both keep the application split off on the backend but closely tied in deployment.

tagged: library zendframework location

Link:

Web Developement Blog:
Curl: Location redirect while open_basedir is set
Feb 04, 2009 @ 12:06:09

Recently on the Web Developement Blog, Olaf showed how to do a Location redirect with cURL while open_basedir is set.

If you need to follow redirects within your php code using Curl and the open_basedir is set you came into some trouble. If you disable this directive all your directories with a 777 permission are not safe (if one or more website on the same server has some security issues). If you don’t have additional protections you should NEVER disable the open_basedir directive (at least if you’re using 3rd party applications).

He writes up a simple cURL-based link checker to see which of the URLs in question would throw an error. He modifies it so that it checked the HTTP response code from the server and, if its a 200/302/301, you know things are okay and a shell_exec can be called to execute the file from that location.

tagged: curl location redirect shellexec openbasedir tutorial

Link: