News Feed
Jobs Feed

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


Lorna Mitchell:
Using Composer Without GitIgnoring Vendor/
March 12, 2014 @ 12:45:23

In her latest post Lorna Mitchell looks at a method, when using Composer and git, to fix an issue around subdirectories that are git repositories and git thinking they should be submodules instead.

Recent additions to the API have introduced some new dependencies so we decided we'd start using Composer to manage these - but we don't want to run composer unsupervised. I'm sure this will bring the rain of "just run composer install, it's probably mostly almost safe" criticism, but actually it's quite tricky to run Composer without excluding vendor/ from source control so I thought I'd share how we did it so that anyone who wants to do so can learn from my experience!

She starts by describing the usual use of Composer - making the "composer.json", running the install and see the "vendor" directory being added. When she tried to check in the dependencies, git gave her an error about wanting them to be submodules. Instead, she figured out a way to add a line to the .gitignore to have it disregard the "vendor/.git" directory, making it work as expected.

0 comments voice your opinion now!
composer vendor install gitignore git


Kevin van Zonneveld:
It's Almost 2014 and We Are Still Committing Broken Code
December 30, 2013 @ 09:19:28

Kevin van Zonneveld has a new post that, while not PHP specific, does have a handy script that will help you stop committing broken code.

Whatever the reason, it's almost 2014 and we are still committing broken code. This needs to stop because best case: Travis or Jenkins prevent those errors from hitting production and it's frustrating to go back and revert/redo that stuff. A waste of your time and state of mind, you were already working on other things. Worst case: your error goes unnoticed and hits production.

To help resolve the problem, he suggests using the "hook" system common to most version control software. In his specific example, he shows the use of a pre-commit hook that fires off a bash script on the files being committed. He includes the full code for this bash script that includes a check for PHP scripts using the built in PHP linter (the "-l" option on the command line). He also includes the commands and updates you'll need to make to get it installed on git.

0 comments voice your opinion now!
git precommit hook syntax error bash script tutorial


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


Zend Framework Blog:
Zend Framework 1 is Migrating to Git!
March 28, 2013 @ 09:29:23

The Zend Framework project has announced a major move for the framework's development - the Zend Framework v1 repositories will be moving from Subversion to Git over the next year or so.

Since its inception, Zend Framework 1 has used Subversion for versioning. However, as we approach its end-of-life (which will occur 12-18 months from the time this post is written), and as our experience with ZF2 processes becomes more familiar, we -- the Zend team and the Community Review team -- feel that we can better support ZF1 via GitHub. As such, we will be migrating the ZF1 Subversion repository to GitHub this week. Please read on for details!

The post details the steps that'll be taken during the process including the changing of the location of the "master" branch (and how to change svn to point to it) and the updates to the integration of the Dojo libraries. They also talk some about the "extras" repository and how things will work with the Issue Tracker and pull requests in the future.

The repository and issues migration is the first step in a series of planned migrations. We also plan to eventually migrate our wiki to GitHub; this will allow us to offload functionality from the main ZF website, and also consolidate all development-related functionality (other than the mailing list) in a central location.
0 comments voice your opinion now!
zendframework1 git migration subversion github
Setting Up A Staging Environment
February 15, 2013 @ 10:49:39

On today Gabriel Manricks walks you through setting up a staging environment using Vagrant to install and setup a virtual machine running Apache 2 and PHP 5.4.

Creating a staging environment is specific to your production environment. There is no magic solution that works in every situation. But most cases follow a similar pattern, and I'll cover all the key points as we go along. It's fair to assume that most people deploy their apps with some kind of versioning tool (like GIT). [...] Besides GIT, you have to think about the languages, software, and "special" features your production servers offer.

All of the commands and configuration files you'll need to make the automatic setup work are included in the article. It's based on a Debian (Squeeze) base image and uses packages to install the needed software. They also install other PHP extensions like mycrypt, GD, curl, APC and database support (MySQL, SQLite and Postgres). They help you get Apache set up to serve the application and work with git and its hooks to push the code and run Composer.

0 comments voice your opinion now!
staging environment tutorial vagrant git apache deployment hooks

Volker Dusch:
If it's not written in PHP it's irrelePHPant!
November 20, 2012 @ 09:11:51

Volker Dusch has a new tongue-in-cheek post to his site talking about a few pieces of useful software that are not written in PHP...and why not?

Dear PHP Community, we need to have a talk about the insufferable state of your software stacks. It was recently brought to my attention that there is software out there, software we use every day!, that is NOT written in PHP. This is completely unacceptable! We are PHPeople! We're not "Web" Developers, we are the web. And we sure as hell are not some fancy "Software Developer", you can ask anyone on the internet! Seriously: If it's not PHP how will we ever be able to extend and adapt it to our needs! We are slaves of our tools!

He mentions several tools that, yes, while not written in PHP are very useful to just about any developer out there (including git, Puppet and Apache). But, more seriously:

PHP is a language that enables absolute beginners to start creating on the web using FTP and notepad! It let's us realize and validate our ideas blazingly fast and allows us to adapt our successful ideas to beautifully scale with our requirements providing and relying on solid, battle-proof tools.
0 comments voice your opinion now!
written language useful tools git travis apache puppet jenkins opinion

Lorna Mitchell:
Do Open Source with Git and Github
September 06, 2012 @ 09:57:34

So you've been working on your own code for a while now but have been hearing about Github and how it makes it simple to contribute to other projects too. Maybe you haven't found the time to get into git and Github yet. Well, this new post (a reprinted article from php|architect) to Lorna Mitchell's blog will tell you all you need to know.

Often I find absolutely competent programmers, who aren't involved in open source, either because they don't know how to approach a project, or because they just aren't sure how the process even works. In this article we'll look at one example, the conference feedback site, and how you can use GitHub to start contributing code to this project. Since so many projects are hosted on github, this will help you get started with other projects, too.

She covers all you'll need to know to get in and get going with Github - forking a current repo (she uses as an example), cloning your fork, making updates and submitting them as a pull request back to the main project. There's also some things about general git topics like branching, merging from the upstream source and using "git log" to view the changes.

0 comments voice your opinion now!
opensource github git introduction fork clone branch tutorial
Installing GitList for Local Repos
August 23, 2012 @ 09:29:59

If you're a git user and have thought about bringing things a bit more "in-house" than GitHub but still want some of the perks of the web-based interface, this quick tutorial from PHPMaster about installing Gitlist might interest you.

aking your repositories available in a local intranet is pretty easy, but having a nice interface to interact with those repositories, making collaboration between teams easier, is not that simple. [...] There are other solutions available, but some are too hard to install or, again, hard on the eyes. I recently discovered GitList, a free and open source Git repository viewer. It's interface resembles GitHub a lot but aims to keep everything simple and clear.

He includes the basic installation steps you'll need to get it up and running - setting up the environment, downloading and configuring Gitlist to look at your repositories and pointing out that, since the LESS source is included in the download, you can customize it how you see fit.

0 comments voice your opinion now!
gitlist git local web interface tutorial install configure

James Morris' Blog:
Deploy a Silex App Using Git Push
July 05, 2012 @ 09:35:40

James Morris has a new post to his blog showing you how you can deploy a Silex-based application via git and a post-receive hook on the server side.

Up until a few days ago I used to use a small bash deployment script to deploy a few simple sites to my live box. The process was a git archive and extract, then an rsync to the live site. Only inspecting it recently I realised that rsync no longer sent just the changes but all of the files, I'd never noticed before as the sites were so small the deploy was over very quickly. The rsync used to work fine before as I would deploy my current working code where the timestamps on files would match the server. Since I started using git at home for dev, the git archive method timestamps the files with the latest commit's timestamp. This messes up rsync.

His process involves a checked in version of Silex, a development branch, a push of the code to the live machine and an install script to set up Silex. He includes the "technical breakdown" and the information needed to replicate it - the .gitignore, setting up password-less SSHing, setting up the server and creating the git post-receive hook (a bash script).

0 comments voice your opinion now!
git push deploy silex application hook tutorial

Community Events

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

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

All content copyright, 2014 :: - Powered by the Solar PHP Framework