News Feed
Jobs Feed
Sections




News Archive
feed this:

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

Zumba Engineering Blog:
Enforce code standards with composer, git hooks, and phpcs
April 15, 2014 @ 09:13:48

The Zumba Engineering blog has a new post looking at a way you can control code quality and standards with the help of Composer, git hooks and the PHP Code Sniffer (phpcs) tools.

Maintaining code quality on projects where there are many developers contributing is a tough assignment. How many times have you tried to contribute to an open-source project only to find the maintainer rejecting your pull request on the grounds of some invisible coding standard? [...] Luckily there are tools that can assist maintainers. In this post, I'll be going over how to use composer, git hooks, and phpcs to enforce code quality rules.

These three technologies are combined together to make a more seamless experience for the developer while keeping the code quality high. Their method makes use of the "scripts" (post-install-cmd) feature of Composer to, after the installation of all packages, set up a git hook script that will run the phpcs checks on pre-commit. It's a pretty simple shell script that kicks back any errors it might find before the user can commit their changes.

0 comments voice your opinion now!
code standards composer git hook phpcs codesniffer install precommit

Link: http://engineering.zumba.com/2014/04/14/control-code-quality

SitePoint PHP Blog:
Git Hooks for Fun and Profit
September 25, 2013 @ 12:45:21

If you're a git user (you do use git, right?), there's a powerful feature that can help perform some automatic actions in your repositories - git hooks. In this new post to the SitePoint PHP blog, Timothy Boronczyk introduces you to them and how to set them up.

When certain commands are run, Git searches the .git/hooks directory for suitable hook scripts which are then executed if found. You'll find a small set of example scripts there (you can activate them by renaming them to remove the .sample prefix and setting their executable bit), and a complete list of hooks can be found in the githooks(5) man page. This article suggests a handful of hooks which can streamline development and help improve your efficiency.

He gives four different examples of checks based on the state of the commit (like pre-commit or post-commit):

  • Lint Checks
  • Spell-Check Commit Messages
  • Checking Standards
  • Automatically Run Composer

Each comes with the example code needed to implement them and some description about what they're doing.

0 comments voice your opinion now!
git hooks introduction example lint spelling standards composer

Link: http://www.sitepoint.com/git-hooks-fun-profit

Federico Cargnelutti:
API Development Tips
July 17, 2013 @ 13:50:45

Federico Cargnelutti has a quick post to his site today sharing some general API tips you could follow when creating your backend application.

Organizations who are paying attention already know they need to have an open web API, and many already have under development or in the wild. Make sure you haven't been caught by the pitfalls of many early API releases.

He briefly mentions the idea of having multiple points of failure and includes five more general tips based on information from this video:

  • Test it all
  • Plan for future versions
  • Embrace standards
  • Monitor everything & be honest
  • Fail well
0 comments voice your opinion now!
api development tips list video test version standards monitoring fail

Link: http://blog.fedecarg.com/2013/07/17/api-development-tips

Lorna Mitchell:
PSR-What?
July 16, 2013 @ 11:19:10

For those out there that might have heard comments made about the PSRs (PHP Standards Recommendations) but aren't quite sure what they're about, Lorna Mitchell has posted an introduction to the three currently approved standards.

There's been some cool things happening in the PHP world over the last few years, but with the least helpful names ever ... yes, those PSR-somethings which all do totally different things (apart from two of them which are the same). They're actually all superb things, and done for a good reason, so I thought I'd try to translate them into normal speak.

She goes through each of the three, explaining what they are and how they could affect your applications:

  • PSR-0 is for autoloading
  • PSR-1 and PSR-2 are for Coding Standards
  • PSR-3 is for Logging

There's no code included in the post showing how they'd be implemented but there are links back to the standards themselves.

0 comments voice your opinion now!
psr standards recommendation autoloading codestandard logging

Link: http://www.lornajane.net/posts/2013/psr-what

Chris Hartjes:
Standards, Soapboxes, and Shamans
January 21, 2013 @ 13:16:47

In this latest post to his site Chris Hartjes shares some of his thoughts about the recently approved PSR-3 standard (for logging) and some of the reception that the other PSRs (PSR-0, 1 & 2) have gotten from the PHP community.

For those who pay attention to the workings of the PHP community you might have heard about the "PHP Standards Recommendations" that have been coming out of the PHP Framwork Interop Group. [...] More recently this group has been working on a standard for logging interfaces called PSR-3. I spoke about this on Twitter, and I will repeat it here: I think PHP programmers should get behind PSR-0 and efforts like PSR-3. I feel that PSR-1 and PSR-2 are solutions looking for a problem and seem, to me anyway, to me out of place with the solutions offered by PSR-0 and PSR-3.

He likens the PHP PSRs to the Python enhancement proposals (PEPs) and, more specifically, to the PEP-8 - their own version of "coding standards" that was highly championed by Guido van Rossum and put into wide practice.

Any programming language community that does not work as hard as possible to make it easier to integrate other's libraries of code together [by standardizing their formatting] is asking for irrelevancy.
0 comments voice your opinion now!
standards psr0 psr1 psr2 psr3 community feedback python pep


Matthew Weier O'Phinney:
On php-fig and Shared Interfaces
December 21, 2012 @ 11:45:37

In his most recent post Matthew Weier O'Phinney (lead on the Zend Framework project) takes a look at the PHP Interoperability Group (php-fig) and some recent discussions that have come up about shared interfaces for things like logging and caching.

A little over a year ago, there was a new push by a number of folks wanting to do more. Paul Jones did a remarkable job of spearheading the next two standards, which centered around coding style. [...] And this is when we started seeing proposals surface for shared interfaces, first around caching, and now around logging (though the latter is the first up for vote).

He talks a bit about shared interfaces - what they are and what kind of problem they aim to solve - and how he's not sure he "buys into them". He notes that "sharing is good, developing solutions is better" and stresses making it easier to operate with each other and not worry so much about standardized interfaces.

He's found a few problems with the concepts behind them like the Not Invented Here (NIH) idea they promote and that there's not really just a single solution to these kinds of problems ("space for multiple implementations"). He suggests an alternative to the idea of these shared interfaces - bridges/adapters. He illustrates this idea with some code showing the implementation of a "CacheInterface" and a "FrameworkACache" adapter that wraps the functionality of a "CacheItem" class that might be internal to your application already.

0 comments voice your opinion now!
phpfig framework interoperability standards interface shared


Richard Rodger:
Why I Have Given Up on Coding Standards
December 05, 2012 @ 13:17:48

In a recent (controversial) post Richard Roger talks about why he's given up on coding standards and includes a few of the reasons that might make you think about your own proceses.

Every developer knows you should have a one, exact, coding standard in your company. Every developer also knows you have to fight to get your rules into the company standard. Every developer secretly despairs when starting a new job, afraid of the crazy coding standard some power-mad architect has dictated. It's better to throw coding standards out and allow free expression. The small win you get from increased conformity does not move the needle. Coding standards are technical ass-covering.

He walks through the evolution of the average developer, the trip from their infancy of "just writing code" to the point of understanding that there needs to be standards to make code easier to read and understand. He includes a list of five "sins of control" that might make coding standards more desirable.

There are worse sins than these. You only need one of them to end up with a coding standard. The truly evil thing about coding standards is what they do to your heart, your team's heart. They are a little message that you are not good enough. You cannot quite be trusted. Without adult supervision, you'll mess up.

As you'd expect, there's plenty of comments on the post, so enjoy reading and maybe contribute some of your own.

0 comments voice your opinion now!
coding standards opinion hurt control freedom


Community News:
PHP-FIG Group Launches Site & FAQ
July 04, 2012 @ 20:25:27

To help resolve issues that have come up around its formation and to keep too much FUD (fear, uncertainty and doubt) from spreading, the "PHP-FIG" (framework interoperability group) has put together a site and a FAQ describing what they're all about.

The FIG stands for Framework Interoperability Group. The name until recently was "PHP Standards Group" but this was somewhat inaccurate of the intentions of the group. [...] The idea behind the group is for project representatives to talk about the commonalities between our projects and find ways we can work together. Our main audience is each other, but we're very aware that the rest of the PHP community is watching.

The FAQ answers other questions about the standards the group has agreed on (passed) so far, who the members of the group are, how to get involved and how framework communities can get involved.

0 comments voice your opinion now!
phpfig interoperability group standards framework


Community News:
Kohana Community Responds to PSR-1 & PSR-2
June 09, 2012 @ 09:10:59

In the Kohana framework, you can get an inside look at the discussion inside a framework community regarding their adherence to the PSR-1 & PSR-2 standards (hint: they're not in favor).

A commentor asks the question "Will Kohana eventually follow the following guidelines?" and is immediately given the simple response of "no". Other comments reinforce this by pointing out some of the differences in the standards that the framwork follows and what the PSR standards outline.

Other posters make comments about the PHP-FIG group themselves, some of the things outlined in the standards and some of their own personal preferences when it comes to the the standards of their own code. You can find more information on the standards here: PSR-1 and PSR-2.

0 comments voice your opinion now!
kohana framework community opinion standards phpfig psr1 psr2


PHPClasses.org:
Lately in PHP, Episode 24 - Do PHP Developers Need & will Adopt PHP Coding Standards
June 04, 2012 @ 11:35:20

The PHPClasses.org site has released the latest episode in their "Lately in PHP" podcast series - Episode 24, "Do PHP Developers Need and will Adopt PHP Coding Standards?"

The PHP Standards Group is trying to push new specifications for PHP coding standards. Whether PHP developers need and will adopt these standards was one of the main topics discussed by Manuel Lemos and Arturs Sosins in episode 24 of the Lately in PHP podcast.

They also talk about some of the comments that Linus Torvalds recently made about the limitations of Github and recent PHP releases (bugfixes). You can listen to this latest episode using the in-page player or you can download the mp3 and listen locally. If you enjoy it, consider subscribing to their feed to get this and future episodes.

0 comments voice your opinion now!
latelyinphp podcast phpclasses standards adoption github



Community Events











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


application hhvm symfony2 component podcast framework series composer install introduction hack unittest language opinion code package facebook security overview release

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