<?xml version="1.0"?>
<rss version="2.0">
  <channel>
    <title>PHPDeveloper.org</title>
    <link>http://www.phpdeveloper.org</link>
    <description>Up-to-the Minute PHP News, views and community</description>
    <language>en-us</language>
    <pubDate>Wed, 19 Jun 2013 22:02:55 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[James Morris' Blog: Deploy a Silex App Using Git Push]]></title>
      <guid>http://www.phpdeveloper.org/news/18184</guid>
      <link>http://www.phpdeveloper.org/news/18184</link>
      <description><![CDATA[<p>
<i>James Morris</i> has a new post to his blog showing you how you can <a href="http://blog.jmoz.co.uk/deploy-git-push-php-silex">deploy a Silex-based application</a> via git and a post-receive hook on the server side.
</p>
<blockquote>
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.
</blockquote>
<p>
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).
</p>]]></description>
      <pubDate>Thu, 05 Jul 2012 09:35:40 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Gonzalo Ayuso's Blog: Building a simple SQL wrapper with PHP. Part 2.]]></title>
      <guid>http://www.phpdeveloper.org/news/18106</guid>
      <link>http://www.phpdeveloper.org/news/18106</link>
      <description><![CDATA[<p>
<i>Gonzalo Ayuso</i> has followed up his <a href="http://phpdeveloper.org/news/17953">previous post</a> about creating a simple SQL wrapper with PDO in PHP with <a href="http://gonzalo123.wordpress.com/2012/06/18/building-a-simple-sql-wrapper-with-php-part-2/">this new post</a>, a "part two" looking at improving it a bit with a new class to represent the tables.
</p>
<blockquote>
In one of our last post we built a <a href="http://gonzalo123.wordpress.com/2012/05/14/building-a-simple-sql-wrapper-with-php/">simple SQL wrapper with PHP</a>. Now we are going to improve it a little bit. We area going to use a class Table instead of the table name. Why? Simple. We want to create triggers. OK we can create triggers directly in the database but sometimes our triggers need to perform operations outside the database, such as call a REST webservice, filesystem's logs or things like that.
</blockquote>
<p>
He includes the updated code with the new "Table" class with methods that let you set up pre- and post-action hooks on each of the types (insert, delete, update) along with the rest of the library, there ready for the copy & pasting.
</p>]]></description>
      <pubDate>Mon, 18 Jun 2012 10:05:50 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Sean Coates' Blog: Deploy on push (from GitHub)]]></title>
      <guid>http://www.phpdeveloper.org/news/18049</guid>
      <link>http://www.phpdeveloper.org/news/18049</link>
      <description><![CDATA[<p>
<i>Sean Coates</i> has a new post today sharing an <a href="http://seancoates.com/blogs/deploy-on-push-from-github">example push process</a> for the times when you either just need to push code (without the build process) or you're just deploying something simple - a "deploy on push" hook built into your github repository.
</p>
<blockquote>
Sometimes, you just need to deploy code when it's ready. You don't need a build; you don't need to run tests - you just need to push code to a server. If you use <a href="http://git-scm.com/">git</a> and <a href="https://github.com/">GitHub</a> (and I think you should be using GitHub), you can easily deploy on push. [...] There are really only three things that you need, in most cases, to make this work: a listener script, a deploy key and associated SSH configuration, and a post-receive hook. 
</blockquote>
<p>
He explains what each part of the process does and includes the simple PHP script that github calls to make the deployment (it's specific to his example, but you get the idea). He walks you through setting up the deploy key (a SSH key generated on your server) and how to get SSH to use this key when github comes knocking.
</p>]]></description>
      <pubDate>Tue, 05 Jun 2012 10:49:13 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Paul Reinheimer's Blog: The Danger of Hooks]]></title>
      <guid>http://www.phpdeveloper.org/news/17383</guid>
      <link>http://www.phpdeveloper.org/news/17383</link>
      <description><![CDATA[<p>
<i>Paul Reinheimer</i> has a recent post to his blog talking about <a href="http://blog.preinheimer.com/index.php?/archives/370-The-Danger-of-Hooks.html">the danger of "hooks"</a> in your development - the functionality several frameworks and other tools come with to allow you to add functionality to the core without having to change the main source.
</p>
<blockquote>
I ran into hooks rather simultaneously with two very different frameworks: Code Igniter and Lithium. In both cases I was using a rather nifty hook to handle ensuring that users were properly authenticated and authorized before accessing a page. [...] One day, while messing around, I accidentally turned off the hook configuration within Code Igniter (actually I clobbered a file, and restored the wrong one). Then, things came crashing down in a horrible cacophony of... actually they didn't. Everything kept working: that was the problem.
</blockquote>
<p>
He shows two solutions he came up with to be sure that his hooks were executed - one for Lithium and the other for CodeIgniter. The Lithium one uses a "_remap" method and the CodeIgniter example uses the magic "__invoke" method to check for an "AUTH_CHECKED" constant that's only defined as a part of his hooks.
</p>
<blockquote>
I'm no longer entirely dependent on one configuration option or file for my security to function. Should it fail, I've got a secondary check in place; this example of defence in depth allows me to be comfortable with the hooks security system once more.
</blockquote>]]></description>
      <pubDate>Thu, 12 Jan 2012 09:12:18 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Adam Patterson's Blog: DIY simple staging server.]]></title>
      <guid>http://www.phpdeveloper.org/news/17026</guid>
      <link>http://www.phpdeveloper.org/news/17026</link>
      <description><![CDATA[<p>
<i>Adam Peterson</i> has posted an interesting idea for those out there running an internal staging server they want to constantly keep up to date with the main line of code (without manual intervention) - <a href="http://www.adampatterson.ca/blog/2011/10/diy-simple-staging-server/">a git pull web frontend</a> combined with git post-receive hooks.
</p>
<blockquote>
This [move from svn to git] left a bit of a gap in my process where I could no longer test on a remote server without updating it manually by S/FTP or opening terminal and manually calling a git pull. Open terminal and manually git pull it did break up the work flow a bit so using the <a href="http://www.dingoframework.com/">Dingo framework</a> I created a very simple Git helper and gave it its own URL something like git/pull.
</blockquote>
<p>
He added a post-receive hook to his git server that calls this "git/pull" URL on the staging server and updates the code on the server. This provides an easy asynchronous way to update things on another server. Note, though, that this should never be done on a publicly accessible server - it's a pretty large security hole (or at the very least made secure somehow). He used <a href="http://www.dingoframework.com/">Dingo</a> to create his interface, but something like the <a href="http://slimframework.com">Slim micro-framework</a> could have worked just as well. You can <a href="https://gist.github.com/1293697">view his code on github</a>.
</p>]]></description>
      <pubDate>Fri, 21 Oct 2011 10:29:41 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Kevin Schroeder's Blog: Zend Framework 2 Event Manager]]></title>
      <guid>http://www.phpdeveloper.org/news/16869</guid>
      <link>http://www.phpdeveloper.org/news/16869</link>
      <description><![CDATA[<p>
<i>Kevin Schroeder</i> has a new post today sharing some of his <a href="http://www.eschrade.com/page/zend-framework-2-event-manager">experience with the Zend Framework 2 Event Manager</a> in a simple example of pre- and post-validation hooks in a model.
</p>
<blockquote>
I got to play with the Event Manager.  I did like the plugin functionality in ZF1, but it required some pretty static coding.  In some cases, like the front controller plugins, it makes more sense (though this way seems more desirable). [...] It's a ZF1 application, but since (it seems) the event manager is self-contained (and the autoloader works with both ZF1 and ZF2) you can simply paste it into your include_path and BOOM, you have an event manager.
</blockquote>
<p>
In his case he has a set of models extending a base class and wanted to introduce pre- and post-validation hooks to make it simpler to check the data he was working with. He includes the code for his base model class showing how he implemented the ZF2 EventManager in his ZF1 application. He attaches an event to the password class property and, on update, it automatically updates a temporary password value too.
</p>
<p>
You can get more information on using the EventManager in <a href="http://phpdeveloper.org/news/16850">this other post</a> from <i>Matthew Weier O'Phinney</a>.
</p>]]></description>
      <pubDate>Fri, 16 Sep 2011 11:40:47 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Freek Lijten's Blog: Git commit hooks using PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/16556</guid>
      <link>http://www.phpdeveloper.org/news/16556</link>
      <description><![CDATA[<p>
In <a href="http://www.freeklijten.nl/home/2011/07/05/Git-commit-hooks-using-PHP">this new post</a> from <i>Freek Lijten</i> he looks at a set of git commit hooks written in PHP for making things happen before, during and post commit.
</p>
<blockquote>
Git hooks are usually found inside the .git/hooks folder of your git repository. Git tends to provide sample hook files there which are postfixed with a .sample extension. These examples are written as shell scripts. Take a look at them if you want, but today we're talking PHP!
</blockquote>
<p>
He briefly touches on the types of hooks you can set up and includes two example scripts showing a pre-commit lint test for the changed files and a check during the commit on the message given for a certain standard (in their case, it must start with a three letter code).
</p>]]></description>
      <pubDate>Wed, 06 Jul 2011 09:48:51 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Christian Weiske's Blog: How to integrate PHP_CodeSniffer with Git repositories?]]></title>
      <guid>http://www.phpdeveloper.org/news/16393</guid>
      <link>http://www.phpdeveloper.org/news/16393</link>
      <description><![CDATA[<p>
<i>Christian Weiske</i> has a problem he hopes you can help with - he's trying to get the <a href="http://pear.php.net/package/PHP_CodeSniffer">PHP_Codesniffer</a> tool integrated into his git workflow (well, the workflow of his team) as an automatic process that runs on commit. Unfortunately he's <a href="http://cweiske.de/tagebuch/codesniffer-git-how.htm">having some issues</a>.
</p>
<blockquote>
At work, we used a SVN server and enforced our project coding standard with a pre-commit hook on the server that ran PHP_CodeSniffer. Whenever a developer tried to commit some code that does not match the standard, he got it rejected. [...] The only way to enforce the standard is a pre-receive hook on our central Git repository server that all devs push to. Just installing the SVN hook on it isn't the solution, though.
</blockquote>
<p>
Because of how git handles commits (possibly multiple in one push) the usual methods won't work. Other tricky things like file renaming and allowing for legacy code check-ins are also needed. He's <a href="http://stackoverflow.com/questions/6120331/git-pre-receive-hook-with-php-codesniffer">posted the question on StackOverflow</a> too, but no one's come up with a good answer yet (at the time of this post).
</p>]]></description>
      <pubDate>Fri, 27 May 2011 11:16:48 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Graham Christensen's Blog: Sane Pre-Commit Hooks for Symfony + Git]]></title>
      <guid>http://www.phpdeveloper.org/news/13107</guid>
      <link>http://www.phpdeveloper.org/news/13107</link>
      <description><![CDATA[<p>
Symfony users will want to check out <a href="http://iamgraham.net/blog/sane-pre-commit-hooks-for-symfony-git">this pre-commit hook</a> for git from <i>Graham Christensen</i> that can help you keep your sanity in place by rebuilding some of the essentials when a commit is made.
</p>
<blockquote>
Throughout my history of working with Symfony, I've noticed a trend that I'll make a minor edit in a database configuration file, forget to actually regenerate the models and forms, commit the edit, and then find several days later (when I do want to regenerate the models) that they're breaking. I then do this little dance of going through the history finding out where exactly I went wrong.
</blockquote>
<p>
To remedy the situation he came up with a pre-commit hook that does the following:
</p>
<ul>
<li>rebuilds SQL from schemas
<li>rebuilds models
<li>rebuilds forms
<li>rebuilds filters
<li>inserts sample SQL data
<li>loads all data from the fixture files
</ul>
<p>
Full example code for the hook is included <a href="http://iamgraham.net/blog/sane-pre-commit-hooks-for-symfony-git">in the post</a>.
</p>]]></description>
      <pubDate>Tue, 25 Aug 2009 13:49:16 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Rob Allen's Blog: Hooks in Action Helpers]]></title>
      <guid>http://www.phpdeveloper.org/news/11348</guid>
      <link>http://www.phpdeveloper.org/news/11348</link>
      <description><![CDATA[<p>
<i>Rob Allen</i> has <a href="http://akrabat.com/2008/11/05/hooks-in-action-helpers/">posted this look</a> at using hooks inside of action helpers (a follow-up from his <a href="http://akrabat.com/2008/10/31/using-action-helpers-in-zend-framework/">previous article</a> on action helpers):
</p>
<blockquote>
Hooks are a feature of action helpers that allow you to automatically run code at certain points in the dispatch cycle. Specially, there are two hook functions available for action helpers: preDispatch and postDispatch. These allow you to ensure that some functionality is always run for each request.
</blockquote>
<p>
He creates a simple action helper that grabs a random quote from an array and drops it into a property of the helper. By defining a preDispatch method inside of the helper, the HelperBroker knows to pull the method in an execute it immediate before the rest of the actions are executed. A calls to addHelper with the hooks defined is all it takes to glue it together with the execution.
</p>]]></description>
      <pubDate>Wed, 05 Nov 2008 09:34:40 -0600</pubDate>
    </item>
  </channel>
</rss>
