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

Knp University:
Our favorite PhpStorm Live Templates: Share yours
Aug 21, 2015 @ 10:49:39

The Knp University site has a posted an article where they've shared their favorite PHPStorm Live templates, a set of handy shortcuts that can make for less typing on your part and, as a result, less development time spent on common keystrokes.

Most editors have a feature like this, and if you’re not leveraging them, you’re slowing yourself down. Seriously: taking a few minutes to get into these now could add up to a lot of hours saved in the future. The vim users at KnpLabs love this kind of stuff, and have published their own snippets (docteurklein, PedroTroller, Einenlum).

In our tutorial about live templates, we turn formhandle into a snippet that types about 10 lines of form-handling boilerplate code from 10 characters of text. So I started wondering: what are some other awesome live templates we should all be using?

To this end, they've created a repository to store some of these helpful shortcuts. Their list so far includes shortcuts for a 404 if statement, several Twig tags, several for use in a controller context and YAML formatting. The repository includes instructions on how to install the shortcuts and how to include only the ones you want.

tagged: phpstorm live template share repository starter snippet shortcut

Link: http://knpuniversity.com/blog/phpstorm-live-templates

Evan Coury's Blog:
Sharing a database connection across modules in Zend Framework 2
Apr 27, 2012 @ 09:54:56

Evan Coury has a new post to his site about a handy method for sharing database connections across modules in a Zend Framework application.

With the new modular infrastructure in Zend Framework 2, one of the most common questions will indoubitably be how to share a database connection across modules. Here’s a quick explanation of how to share your database connection across multiple modules in a way that can even allow you to use a single connection between ZendDb, Doctrine2, and possibly even other database libraries / ORMs.

He includes the code in the post to configure this application-wide database resource, a "masterdb_pdo" that uses a MySQL backend. This configuration is used to set up the connection in a dependency injection container for later (globalish) use. He also mentions something similar about sharing Doctrine connections with the ZendDb components (using the same DI container approach).

tagged: share database connection module application zenddb zenddi doctrine2

Link:

Kevin Schroeder's Blog:
Call for webinars (Zend)
Jan 18, 2012 @ 11:50:07

Kevin Schroeder is looking for suggestions. He wants to know what the PHP community wants to hear about in upcoming webinars from Zend.

Just wrapped up a call working on our webinar schedule for the year. We’ve got a bunch of ideas but we’d like to also get your input as well. Yes, I know y’all want ZF2 webinars. We have that down. I would also like to do an HTML5 and mobile webinar but I need an SME (Subject Matter Expert) for that. [...] I would also love to have webinars on how to use various API’s, even if there is not native PHP support. So, what kinds of webinars do you want?

Leave your suggestions in his comments along with one already suggesting a "Why PHP?" checklist of sorts to help encourage companies/employers to go with the language.

tagged: opinion webinar share zend zf2 html5 api

Link:

Anthony Ferrara's Blog:
Becoming A Better Developer
Nov 09, 2011 @ 08:54:27

Anthony Ferrara has a new post today on his blog with some things he think you can do to become a better overall developer (and not just in PHP). He shares six things from his own experience to help answer this question.

One of the most frequent questions that I get asked is "How can I become a better developer?" I think that it's a very good question to ask that deserves a good response. But how can you respond to something like that? Becoming a better developer depends so heavily on past experience (where to grow), interests and rationale (why do you want to grow), that it's really hard to answer without a fair bit of discussion. This post reflects my experiences from both my own growth and the growth that I've seen in others.

The things on his list are pretty simple, but they're easy to forget in your day to day development life. Things like being motivated to better yourself, gaining confidence in your abilities, sharing your knowledge and/or becoming a mentor to developers with less experience than you. Interestingly enough, this last one can sometimes teach you a little something about you and your processes too.

tagged: better developer opinion motivation confidence learn share mentor

Link:

99Points.info:
Youtube Style Share Button With URL Shortening using CURL, jQuery and PHP
Jul 29, 2010 @ 12:38:28

In a recent post on the 99Points.info blog Zeeshan Rasool walks you through the steps to create a share button with URL shortening using PHP, jQuery and curl.

These days every website must contain a section that is called “Share This”. After creating facebook style posting and youtube style rating system I have now come to share button. I have created youtube style share button with url shortening script. Try the demo and use this awesome tutorial on your web pages.

His tutorial includes all of the code needed - Javascript, PHP and some CSS - to create a small "share this" button that can be embedded in your site to open pages on the remote sites with the shortened URL for the current page.

tagged: tutorial url shorten share curl jquery youtube

Link:

Sebastian Bergmann's Blog:
Sharing Fixtures and Stubbing/Mocking Static Methods
Feb 15, 2010 @ 12:55:49

Sebastian Bergmann has two recent posts dealing with some of the more difficult topics in unit testing. One looks at sharing fixtures between tests and the other talks about stubbing and mocking static methods in your tests.

From the first of the two tutorials:

A good example of a fixture that makes sense to share across several tests is a database connection: you log into the database once and reuse the database connection instead of creating a new connection for each test. This makes your tests run faster.

This fixture sharing example uses the setUpBeforeClass and tearDownAfterClass methods to create and destroy the connection.

In the second article Sebastian shows how to mock up a sample static function and mock it with the "staticExpects" helper.

tagged: phpunit unittest stub mock static share fixture

Link:

Web Development Blog:
Search for photos using PHP and the flickr API
Dec 21, 2009 @ 15:16:31

On the Web Development Blog there's a recent post about connecting your PHP application with the Flickr API to search for photos with the help of a simple class.

We will be using the php function "file_get_contents" to receive data from flickr. The data which we will receive will be a serialized PHP array which means all we need to do is unserialize the array and we will easily be able to use the data returned. As an alternative we can use a cURL function to get the data, for example if the function "file_get_contents" is not allowed on your web host.

They show how to get your API key from the Flickr website and the sample code that you'll need to make a GET request (with file_get_contents) and an example of a loop displaying the response.

tagged: flickr share api connect tutorial

Link:

Community News:
phpanywhere (Online PHP IDE)
Apr 29, 2009 @ 11:12:18

The phpanywhere site boasts itself as "the easiest way to bring work with you anywhere you go - without bringing anything". The free (still in beta) service offers online PHP editing through a web browser interface.

PHPanywhere is a web based free Integrated Development Environment or IDE for the PHP language, in other words it is an application that gives developers all the code editing capabilities they need to develop PHP applications online. It includes a real-time syntax code editor with support for all web formats and a powerful FTP editor.

You can add in FTP servers and pull files directly from them to edit and upload back over. You can also use the project sharing to allow others to see the current state of your code (real-time collaboration is "coming soon"). You can see screenshots of the editor interface, setting up FTP sites and modifying permissions for the files.

tagged: phpanywhere online ide edit ftp share

Link:

Brandon Savage's Blog:
Where Comments Are Useful
Jan 01, 2009 @ 20:04:45

Brandon Savage has his own response to the "comments are harmful" post over on the PHP in Action blog:

There's a lot of good advice, especially about writing clean code. But the article fails to address a good number of really critical details and to some degree misses the point of Eli's article.

He mentions these points - the value of writing comments before hand, the usefulness of descriptive comments, how they can be used as a todo pointing to future development and using them to share the knowledge and let other people in on what you're thinking.

tagged: comment useful before descriptive future development share

Link:

Nexen.net:
PHP Statistics for April 2008
May 06, 2008 @ 15:17:41

Damien Seguy has released the latest PHP statistics for last month - April 2008. Among the highlights are things like:

  • PHP 5.2.5 is now the most popular PHP version, ahead of 4.4.8
  • PHP 5 reaches 36.60% of PHP market share
  • Still a lot of migrations toward 5.2.5 and 4.4.8

You can check out the details on these and other statistics (like PHP usage by country and version) the complete monthly stats and the evolution stats. Oh, and don't forget - Damien and crew are the ones supplying the latest edition of the elePHPants to the PHP community!

tagged: user statistics popular version market share nexen

Link: