From 1a44f505203d1d85aacf0fd9123f1d1abffe20ec Mon Sep 17 00:00:00 2001 From: Markus Hausammann Date: Wed, 14 Nov 2012 18:57:31 +0200 Subject: [PATCH 01/22] new chapter about building, deployment and CI --- _posts/09-05-01-Building your Application.md | 95 ++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 _posts/09-05-01-Building your Application.md diff --git a/_posts/09-05-01-Building your Application.md b/_posts/09-05-01-Building your Application.md new file mode 100644 index 0000000..da039b3 --- /dev/null +++ b/_posts/09-05-01-Building your Application.md @@ -0,0 +1,95 @@ +--- +isChild: true +--- + +## Building and Deploying your Application {#build_title} + +If you find yourself doing manual database schema changes or running your tests manually before updating your files (manually), think twice! With every additional manual task needed to deploy a new version of your app, the chances for potentially fatal mistakes increase. Whether you're dealing with a simple update, a comprehensive build process or even a continuous integration strategy, build tools are your friend. + +### Control your deployment with Phing + +With [Phing](http://www.phing.info/) you can control your packaging, deployment or testing process from within a simple XML build file. Phing provides a rich set of tasks usually needed to install or update a web app and can be extended with additional custom tasks (written in PHP). + +Example of a Phing script (build.xml): + +{% highlight xml %} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +{% endhighlight %} + +### Continuous Integration + +> Continuous Integration is a software development practice where members of a team integrate their work frequently, usually each person integrates at least daily — leading to multiple integrations per day. Many teams find that this approach leads to significantly reduced integration problems and allows a team to develop cohesive software more rapidly. + +*Martin Fowler* + +There are different ways to implement continuous integration for PHP. Recently [Travis CI](https://travis-ci.org/) has become by far the easiest way to do CI. Travis CI is a hosted continuous integration service for the open source community. It is integrated with GitHub and offers first class support for many languages including PHP. + +Example of a Travis CI build script: + +{% highlight yml %} + + language: php + + # list any PHP version you want to test against + php: + # aliased to a recent 5.3.x version + - 5.3 + # aliased to a recent 5.4.x version + - 5.4 + + # optionally specify a list of environments, for example to test different RDBMS + env: + - DB=mysql + - DB=pgsql + + # execute any number of scripts before the test run, custom env's are available as variables + before_script: + - if [[ "$DB" == "pgsql" ]]; then psql -c "DROP DATABASE IF EXISTS hello_world_test;" -U postgres; fi + - if [[ "$DB" == "pgsql" ]]; then psql -c "create database hello_world_test;" -U postgres; fi + - if [[ "$DB" == "mysql" ]]; then mysql -e "create database IF NOT EXISTS hello_world_test;" -uroot; fi + + script: phpunit --configuration phpunit_$DB.xml --coverage-text + +{% endhighlight %} + +Further reading: + +* [Continuous Integration with Jenkins](http://jenkins-ci.org/) +* [Continuous Integration with Teamcity](http://www.jetbrains.com/teamcity/) \ No newline at end of file From 0487a30e4d08011ab2d97ab9712749145ed946a7 Mon Sep 17 00:00:00 2001 From: Marin Ivanov Date: Thu, 22 Nov 2012 04:20:25 +0200 Subject: [PATCH 02/22] Added links to bg.phptherightway.com for Bulgarian translation --- README.md | 1 + _includes/welcome.md | 1 + 2 files changed, 2 insertions(+) diff --git a/README.md b/README.md index d4bbe96..afcab61 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,7 @@ developers know where to find good information! * [Chinese](http://wulijun.github.com/php-the-right-way) * [Ukrainian](http://iflista.github.com/php-the-right-way) * [Portuguese](http://br.phptherightway.com/) +* [Bulgarian](http://bg.phptherightway.com/) ### Translations diff --git a/_includes/welcome.md b/_includes/welcome.md index eaa0a64..a37f707 100644 --- a/_includes/welcome.md +++ b/_includes/welcome.md @@ -16,6 +16,7 @@ _PHP: The Right Way_ is (or soon will be) translated into many different languag * Russian (Coming Soon) * [Spanish](http://es.phptherightway.com) * [Ukrainian](http://iflista.github.com/php-the-right-way/) +* [Bulgarian](http://bg.phptherightway.com/) ## Disclaimer From 1baa0436df5fd6058cc9f3321b5ef716c465d5ef Mon Sep 17 00:00:00 2001 From: Markus Hausammann Date: Fri, 23 Nov 2012 23:03:24 +0200 Subject: [PATCH 03/22] added chef and capistrano to deployment chapter --- _posts/09-05-01-Building your Application.md | 36 ++++++++++++++++---- 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/_posts/09-05-01-Building your Application.md b/_posts/09-05-01-Building your Application.md index da039b3..4701a75 100644 --- a/_posts/09-05-01-Building your Application.md +++ b/_posts/09-05-01-Building your Application.md @@ -4,11 +4,16 @@ isChild: true ## Building and Deploying your Application {#build_title} -If you find yourself doing manual database schema changes or running your tests manually before updating your files (manually), think twice! With every additional manual task needed to deploy a new version of your app, the chances for potentially fatal mistakes increase. Whether you're dealing with a simple update, a comprehensive build process or even a continuous integration strategy, build tools are your friend. +If you find yourself doing manual database schema changes or running your tests manually before updating your files (manually), +think twice! With every additional manual task needed to deploy a new version of your app, the chances for potentially +fatal mistakes increase. Whether you're dealing with a simple update, a comprehensive build process or even a continuous +integration strategy, build tools are your friend. -### Control your deployment with Phing +### Phing - Deployment with XML and PHP -With [Phing](http://www.phing.info/) you can control your packaging, deployment or testing process from within a simple XML build file. Phing provides a rich set of tasks usually needed to install or update a web app and can be extended with additional custom tasks (written in PHP). +[Phing](http://www.phing.info/) is the easiest way to get started with automated deployment in the PHP world. With Phing you can control your packaging, deployment or testing process from within a simple +XML build file. Phing provides a rich set of tasks usually needed to install or update a web app and can be extended +with additional custom tasks, written in PHP. Example of a Phing script (build.xml): @@ -18,7 +23,7 @@ Example of a Phing script (build.xml): + promptText="What's the target environment (development, production)?" useExistingValue="true" /> @@ -53,13 +58,32 @@ Example of a Phing script (build.xml): {% endhighlight %} +### Capistrano - The powerful Ruby alternative + +[Capistrano](https://github.com/capistrano/capistrano/wiki) is a system for *intermediate-to-advanced programmers* to execute commands in a structured, repeatable way on one or more remote machines. + +It is pre-configured for deploying Ruby on Rails applications, however people are **successfully deploying PHP systems** with it. Successful use of Capistrano depends on a working knowledge of Ruby and Rake. + +Dave Gardner's blog post [PHP Deployment with Capistrano](http://www.davegardner.me.uk/blog/2012/02/13/php-deployment-with-capistrano/) is a good starting point for PHP developers interested in Capistrano. + +###Chef - Ruby based system integration framework + +[Chef](http://www.opscode.com/chef/) is more than a deployment framework, it is a very powerful Ruby based system integration framework that doesn't just deploy your app but can build your whole server environment or virtual boxes. + +Chef resources for PHP developers: + +* [Three part blog series about deploying a LAMP application with Chef, Vagrant, and EC2](http://www.jasongrimes.org/2012/06/managing-lamp-environments-with-chef-vagrant-and-ec2-1-of-3/) +* [Chef Cookbook which installs and configures PHP 5.3 and the PEAR package management system](https://github.com/opscode-cookbooks/php) + ### Continuous Integration -> Continuous Integration is a software development practice where members of a team integrate their work frequently, usually each person integrates at least daily — leading to multiple integrations per day. Many teams find that this approach leads to significantly reduced integration problems and allows a team to develop cohesive software more rapidly. +> Continuous Integration is a software development practice where members of a team integrate their work frequently, +usually each person integrates at least daily — leading to multiple integrations per day. Many teams find that this +approach leads to significantly reduced integration problems and allows a team to develop cohesive software more rapidly. *Martin Fowler* -There are different ways to implement continuous integration for PHP. Recently [Travis CI](https://travis-ci.org/) has become by far the easiest way to do CI. Travis CI is a hosted continuous integration service for the open source community. It is integrated with GitHub and offers first class support for many languages including PHP. +There are different ways to implement continuous integration for PHP. Recently [Travis CI](https://travis-ci.org/) has done a great job of making continuous integration a reality even for small projects. Travis CI is a hosted continuous integration service for the open source community. It is integrated with GitHub and offers first class support for many languages including PHP. Example of a Travis CI build script: From e354d95842f65587956e0a006bcc2d833a776282 Mon Sep 17 00:00:00 2001 From: Markus Hausammann Date: Fri, 23 Nov 2012 23:10:15 +0200 Subject: [PATCH 04/22] line wraps for easier read --- _posts/09-05-01-Building your Application.md | 30 +++++++++++++------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/_posts/09-05-01-Building your Application.md b/_posts/09-05-01-Building your Application.md index 4701a75..9dfab93 100644 --- a/_posts/09-05-01-Building your Application.md +++ b/_posts/09-05-01-Building your Application.md @@ -4,15 +4,16 @@ isChild: true ## Building and Deploying your Application {#build_title} -If you find yourself doing manual database schema changes or running your tests manually before updating your files (manually), -think twice! With every additional manual task needed to deploy a new version of your app, the chances for potentially -fatal mistakes increase. Whether you're dealing with a simple update, a comprehensive build process or even a continuous -integration strategy, build tools are your friend. +If you find yourself doing manual database schema changes or running your tests manually before updating your files +(manually), think twice! With every additional manual task needed to deploy a new version of your app, the chances for +potentially fatal mistakes increase. Whether you're dealing with a simple update, a comprehensive build process or even +a continuous integration strategy, build tools are your friend. ### Phing - Deployment with XML and PHP -[Phing](http://www.phing.info/) is the easiest way to get started with automated deployment in the PHP world. With Phing you can control your packaging, deployment or testing process from within a simple -XML build file. Phing provides a rich set of tasks usually needed to install or update a web app and can be extended +[Phing](http://www.phing.info/) is the easiest way to get started with automated deployment in the PHP world. +With Phing you can control your packaging, deployment or testing process from within a simple XML build file. +Phing provides a rich set of tasks usually needed to install or update a web app and can be extended with additional custom tasks, written in PHP. Example of a Phing script (build.xml): @@ -60,15 +61,19 @@ Example of a Phing script (build.xml): ### Capistrano - The powerful Ruby alternative -[Capistrano](https://github.com/capistrano/capistrano/wiki) is a system for *intermediate-to-advanced programmers* to execute commands in a structured, repeatable way on one or more remote machines. +[Capistrano](https://github.com/capistrano/capistrano/wiki) is a system for *intermediate-to-advanced programmers* +to execute commands in a structured, repeatable way on one or more remote machines. -It is pre-configured for deploying Ruby on Rails applications, however people are **successfully deploying PHP systems** with it. Successful use of Capistrano depends on a working knowledge of Ruby and Rake. +It is pre-configured for deploying Ruby on Rails applications, however people are **successfully deploying PHP systems** +with it. Successful use of Capistrano depends on a working knowledge of Ruby and Rake. -Dave Gardner's blog post [PHP Deployment with Capistrano](http://www.davegardner.me.uk/blog/2012/02/13/php-deployment-with-capistrano/) is a good starting point for PHP developers interested in Capistrano. +Dave Gardner's blog post [PHP Deployment with Capistrano](http://www.davegardner.me.uk/blog/2012/02/13/php-deployment-with-capistrano/) +is a good starting point for PHP developers interested in Capistrano. ###Chef - Ruby based system integration framework -[Chef](http://www.opscode.com/chef/) is more than a deployment framework, it is a very powerful Ruby based system integration framework that doesn't just deploy your app but can build your whole server environment or virtual boxes. +[Chef](http://www.opscode.com/chef/) is more than a deployment framework, it is a very powerful Ruby based system +integration framework that doesn't just deploy your app but can build your whole server environment or virtual boxes. Chef resources for PHP developers: @@ -83,7 +88,10 @@ approach leads to significantly reduced integration problems and allows a team t *Martin Fowler* -There are different ways to implement continuous integration for PHP. Recently [Travis CI](https://travis-ci.org/) has done a great job of making continuous integration a reality even for small projects. Travis CI is a hosted continuous integration service for the open source community. It is integrated with GitHub and offers first class support for many languages including PHP. +There are different ways to implement continuous integration for PHP. Recently [Travis CI](https://travis-ci.org/) has +done a great job of making continuous integration a reality even for small projects. Travis CI is a hosted continuous +integration service for the open source community. It is integrated with GitHub and offers first class support for many +languages including PHP. Example of a Travis CI build script: From 8f15552dece7382f40c52d6ef894100c6be2223e Mon Sep 17 00:00:00 2001 From: Markus Hausammann Date: Thu, 29 Nov 2012 14:55:28 +0200 Subject: [PATCH 05/22] make chapter topic based instead of product based --- _posts/09-05-01-Building your Application.md | 93 ++++---------------- 1 file changed, 15 insertions(+), 78 deletions(-) diff --git a/_posts/09-05-01-Building your Application.md b/_posts/09-05-01-Building your Application.md index 9dfab93..00273ee 100644 --- a/_posts/09-05-01-Building your Application.md +++ b/_posts/09-05-01-Building your Application.md @@ -7,71 +7,36 @@ isChild: true If you find yourself doing manual database schema changes or running your tests manually before updating your files (manually), think twice! With every additional manual task needed to deploy a new version of your app, the chances for potentially fatal mistakes increase. Whether you're dealing with a simple update, a comprehensive build process or even -a continuous integration strategy, build tools are your friend. +a continuous integration strategy, [build automation](http://en.wikipedia.org/wiki/Build_automation) is your friend. -### Phing - Deployment with XML and PHP +Among the tasks you might want to automate are: + +* dependency management +* compilation, minification of your assets +* running tests +* creation of documentation +* packaging +* deployment + + +### Build Automation Tools + +Build tools can be described as a collection of scripts that handle common tasks of software deployment. The build tool +is not a part of your software, it acts on your software from 'outside'. [Phing](http://www.phing.info/) is the easiest way to get started with automated deployment in the PHP world. With Phing you can control your packaging, deployment or testing process from within a simple XML build file. Phing provides a rich set of tasks usually needed to install or update a web app and can be extended with additional custom tasks, written in PHP. -Example of a Phing script (build.xml): - -{% highlight xml %} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -{% endhighlight %} - -### Capistrano - The powerful Ruby alternative - [Capistrano](https://github.com/capistrano/capistrano/wiki) is a system for *intermediate-to-advanced programmers* to execute commands in a structured, repeatable way on one or more remote machines. - It is pre-configured for deploying Ruby on Rails applications, however people are **successfully deploying PHP systems** with it. Successful use of Capistrano depends on a working knowledge of Ruby and Rake. Dave Gardner's blog post [PHP Deployment with Capistrano](http://www.davegardner.me.uk/blog/2012/02/13/php-deployment-with-capistrano/) is a good starting point for PHP developers interested in Capistrano. -###Chef - Ruby based system integration framework - [Chef](http://www.opscode.com/chef/) is more than a deployment framework, it is a very powerful Ruby based system integration framework that doesn't just deploy your app but can build your whole server environment or virtual boxes. @@ -93,34 +58,6 @@ done a great job of making continuous integration a reality even for small proje integration service for the open source community. It is integrated with GitHub and offers first class support for many languages including PHP. -Example of a Travis CI build script: - -{% highlight yml %} - - language: php - - # list any PHP version you want to test against - php: - # aliased to a recent 5.3.x version - - 5.3 - # aliased to a recent 5.4.x version - - 5.4 - - # optionally specify a list of environments, for example to test different RDBMS - env: - - DB=mysql - - DB=pgsql - - # execute any number of scripts before the test run, custom env's are available as variables - before_script: - - if [[ "$DB" == "pgsql" ]]; then psql -c "DROP DATABASE IF EXISTS hello_world_test;" -U postgres; fi - - if [[ "$DB" == "pgsql" ]]; then psql -c "create database hello_world_test;" -U postgres; fi - - if [[ "$DB" == "mysql" ]]; then mysql -e "create database IF NOT EXISTS hello_world_test;" -uroot; fi - - script: phpunit --configuration phpunit_$DB.xml --coverage-text - -{% endhighlight %} - Further reading: * [Continuous Integration with Jenkins](http://jenkins-ci.org/) From 45dc8214aa1213e6f34537e4c9303ee60f52462d Mon Sep 17 00:00:00 2001 From: Markus Hausammann Date: Thu, 29 Nov 2012 15:24:23 +0200 Subject: [PATCH 06/22] add information about ant and maven --- _posts/09-05-01-Building your Application.md | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/_posts/09-05-01-Building your Application.md b/_posts/09-05-01-Building your Application.md index 00273ee..8b08603 100644 --- a/_posts/09-05-01-Building your Application.md +++ b/_posts/09-05-01-Building your Application.md @@ -22,12 +22,15 @@ Among the tasks you might want to automate are: ### Build Automation Tools Build tools can be described as a collection of scripts that handle common tasks of software deployment. The build tool -is not a part of your software, it acts on your software from 'outside'. +is not a part of your software, it acts on your software from 'outside'. + +There are many open source tools available to help you with build automation, some are written in PHP others aren't. +This shouldn't hold you back from using them, if they're better suited for the specific job. Here are a few examples: [Phing](http://www.phing.info/) is the easiest way to get started with automated deployment in the PHP world. With Phing you can control your packaging, deployment or testing process from within a simple XML build file. -Phing provides a rich set of tasks usually needed to install or update a web app and can be extended -with additional custom tasks, written in PHP. +Phing (which is based on [Apache Ant](http://ant.apache.org/)) provides a rich set of tasks usually needed to install or +update a web app and can be extended with additional custom tasks, written in PHP. [Capistrano](https://github.com/capistrano/capistrano/wiki) is a system for *intermediate-to-advanced programmers* to execute commands in a structured, repeatable way on one or more remote machines. @@ -45,6 +48,11 @@ Chef resources for PHP developers: * [Three part blog series about deploying a LAMP application with Chef, Vagrant, and EC2](http://www.jasongrimes.org/2012/06/managing-lamp-environments-with-chef-vagrant-and-ec2-1-of-3/) * [Chef Cookbook which installs and configures PHP 5.3 and the PEAR package management system](https://github.com/opscode-cookbooks/php) +Further reading: + +* [Automate your project with Apache Ant](http://net.tutsplus.com/tutorials/other/automate-your-projects-with-apache-ant/) +* [Maven](http://maven.apache.org/), a build framework based on Ant and [how to use it with PHP](http://www.php-maven.org/) + ### Continuous Integration > Continuous Integration is a software development practice where members of a team integrate their work frequently, From 0e06acf705d6300a52fed40aa0dc33fa45fae429 Mon Sep 17 00:00:00 2001 From: paaswatch Date: Thu, 29 Nov 2012 14:41:44 +0100 Subject: [PATCH 07/22] Update _posts/11-01-01-Resources.md phpfog.com will discontinue the service at the end of the year. Added: AppFog and fortrabbit --- _posts/11-01-01-Resources.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/_posts/11-01-01-Resources.md b/_posts/11-01-01-Resources.md index bab9bd7..f91e620 100644 --- a/_posts/11-01-01-Resources.md +++ b/_posts/11-01-01-Resources.md @@ -24,7 +24,8 @@ ## PHP PaaS Providers * [PagodaBox](https://pagodabox.com/) -* [PHP Fog](https://phpfog.com/) +* [AppFog](https://appfog.com/) +* [fortrabbit](https://fortrabbit.com/) * [Engine Yard Orchestra PHP Platform](http://www.engineyard.com/products/orchestra/) * [Red Hat OpenShift Platform](http://www.redhat.com/products/cloud-computing/openshift/) * [dotCloud](http://docs.dotcloud.com/services/php/) From f061f6714a306badd5101ef8af8e32ad2763ae3f Mon Sep 17 00:00:00 2001 From: paaswatch Date: Thu, 29 Nov 2012 14:42:33 +0100 Subject: [PATCH 08/22] Update _posts/11-01-01-Resources.md --- _posts/11-01-01-Resources.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_posts/11-01-01-Resources.md b/_posts/11-01-01-Resources.md index f91e620..2fede3d 100644 --- a/_posts/11-01-01-Resources.md +++ b/_posts/11-01-01-Resources.md @@ -25,7 +25,7 @@ * [PagodaBox](https://pagodabox.com/) * [AppFog](https://appfog.com/) -* [fortrabbit](https://fortrabbit.com/) +* [fortrabbit](http://fortrabbit.com/) * [Engine Yard Orchestra PHP Platform](http://www.engineyard.com/products/orchestra/) * [Red Hat OpenShift Platform](http://www.redhat.com/products/cloud-computing/openshift/) * [dotCloud](http://docs.dotcloud.com/services/php/) From 937460126aa6477018eafdd2017a9bc3da825c78 Mon Sep 17 00:00:00 2001 From: Gerard Roche Date: Sat, 1 Dec 2012 11:13:37 +0000 Subject: [PATCH 09/22] Update _posts/07-07-01-Error-Reporting.md --- _posts/07-07-01-Error-Reporting.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/_posts/07-07-01-Error-Reporting.md b/_posts/07-07-01-Error-Reporting.md index 1eee78d..9fd4094 100644 --- a/_posts/07-07-01-Error-Reporting.md +++ b/_posts/07-07-01-Error-Reporting.md @@ -43,6 +43,6 @@ To hide the errors on your production environment, configure yo With these settings in production, errors will still be logged to the error logs for the web server, but will not be shown to the user. For more information on these settings, see the PHP manual: -* [Error_reporting](http://www.php.net/manual/en/errorfunc.configuration.php#ini.error-reporting) -* [Display_errors](http://www.php.net/manual/en/errorfunc.configuration.php#ini.display-errors) -* [Log_errors](http://www.php.net/manual/en/errorfunc.configuration.php#ini.log-errors) \ No newline at end of file +* [error_reporting](http://php.net/manual/errorfunc.configuration.php#ini.error-reporting) +* [display_errors](http://php.net/manual/errorfunc.configuration.php#ini.display-errors) +* [log_errors](http://php.net/manual/errorfunc.configuration.php#ini.log-errors) \ No newline at end of file From bcff8df579e78c33f16c990edacc3866b245d4f4 Mon Sep 17 00:00:00 2001 From: Markus Hausammann Date: Sun, 2 Dec 2012 03:23:36 +0200 Subject: [PATCH 10/22] capitalise bullet points --- _posts/09-05-01-Building your Application.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/_posts/09-05-01-Building your Application.md b/_posts/09-05-01-Building your Application.md index 8b08603..66e99dc 100644 --- a/_posts/09-05-01-Building your Application.md +++ b/_posts/09-05-01-Building your Application.md @@ -11,12 +11,12 @@ a continuous integration strategy, [build automation](http://en.wikipedia.org/wi Among the tasks you might want to automate are: -* dependency management -* compilation, minification of your assets -* running tests -* creation of documentation -* packaging -* deployment +* Dependency management +* Compilation, minification of your assets +* Running tests +* Creation of documentation +* Packaging +* Deployment ### Build Automation Tools From 1ac7c580ade0b755bbe3c9924e2d60cb130e46a1 Mon Sep 17 00:00:00 2001 From: Sebastian Goettschkes Date: Tue, 4 Dec 2012 16:17:24 +0100 Subject: [PATCH 11/22] Updating pear description --- _posts/04-03-01-PEAR.md | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/_posts/04-03-01-PEAR.md b/_posts/04-03-01-PEAR.md index e0f0194..61d0ce4 100644 --- a/_posts/04-03-01-PEAR.md +++ b/_posts/04-03-01-PEAR.md @@ -4,6 +4,36 @@ isChild: true ## PEAR {#pear_title} -Another veteran package manager that many PHP developers enjoy is [PEAR][1]. It behaves much the same way, and is also worth researching for your projects. [Learn about PEAR][1]. +Another veteran package manager that many PHP developers enjoy is [PEAR][1]. It behaves much the same way as Composer, +but has some noteable differences. + +PEAR requires each package to have a specific structure, which means that the author of the package must prepare it +for usage with PEAR. Using a project which was not prepared to work with PEAR is not possible. + +PEAR installs packages globally, which means after installing them once they are available to all projects on that +server. This can be good if many projects rely on the same package with the same version but might lead to problems +if version conflicts between two projects arise. + +### How to install PEAR + +You can install PEAR by downloading the phar installer and executing it. The PEAR documentation has detailed +[install instructions][2] for every operating system. + +If you are using Linux, you can also have a look at your distribution package manager. Debian and Ubuntu for example +have a apt ``php-pear`` package. + +### How to install a package + +If the package is listed on the [PEAR packages list][3], you can install it by specifying the official name: + + pear install foo + +If the package is hosted on another channel, you need to `discover` the channel first and also specify it when +installing. See the [Using channel docs][4] for more information on this topic. + +* [Learn about PEAR][1] [1]: http://pear.php.net/ +[2]: http://pear.php.net/manual/en/installation.getting.php +[3]: http://pear.php.net/packages.php +[4]: http://pear.php.net/manual/en/guide.users.commandline.channels.php From 50ef1b10bd2d737dd0344750387cf8f449c71460 Mon Sep 17 00:00:00 2001 From: Ryan McAllen Date: Tue, 4 Dec 2012 13:20:18 -0500 Subject: [PATCH 12/22] Fixed misspelling --- pages/Functional-Programming.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/Functional-Programming.md b/pages/Functional-Programming.md index 6d129c3..f9dc9a0 100644 --- a/pages/Functional-Programming.md +++ b/pages/Functional-Programming.md @@ -71,7 +71,7 @@ print_r($output); // items > 3 {% endhighlight %} Each filter function in the family accepts only elements greater than some minimum value. Single filter returned by -`criteria_greater_than` is a closure whith `$min` argument closed by the value in the scope (given as an argument when +`criteria_greater_than` is a closure with `$min` argument closed by the value in the scope (given as an argument when `criteria_greater_than` is called). Early binding is used by default for importing `$min` variable into the created function. For true closures with late From 5c412a4c877dadfba739d08dba2e44b133a869ea Mon Sep 17 00:00:00 2001 From: Jeremy Cloutier Date: Tue, 4 Dec 2012 15:35:28 -0500 Subject: [PATCH 13/22] fixed blockquote and removed linebreaks "Building your Application" --- _posts/09-05-01-Building your Application.md | 36 +++++--------------- 1 file changed, 9 insertions(+), 27 deletions(-) diff --git a/_posts/09-05-01-Building your Application.md b/_posts/09-05-01-Building your Application.md index 66e99dc..bccdc16 100644 --- a/_posts/09-05-01-Building your Application.md +++ b/_posts/09-05-01-Building your Application.md @@ -4,10 +4,7 @@ isChild: true ## Building and Deploying your Application {#build_title} -If you find yourself doing manual database schema changes or running your tests manually before updating your files -(manually), think twice! With every additional manual task needed to deploy a new version of your app, the chances for -potentially fatal mistakes increase. Whether you're dealing with a simple update, a comprehensive build process or even -a continuous integration strategy, [build automation](http://en.wikipedia.org/wiki/Build_automation) is your friend. +If you find yourself doing manual database schema changes or running your tests manually before updating your files (manually), think twice! With every additional manual task needed to deploy a new version of your app, the chances for potentially fatal mistakes increase. Whether you're dealing with a simple update, a comprehensive build process or even a continuous integration strategy, [build automation](http://en.wikipedia.org/wiki/Build_automation) is your friend. Among the tasks you might want to automate are: @@ -21,27 +18,17 @@ Among the tasks you might want to automate are: ### Build Automation Tools -Build tools can be described as a collection of scripts that handle common tasks of software deployment. The build tool -is not a part of your software, it acts on your software from 'outside'. +Build tools can be described as a collection of scripts that handle common tasks of software deployment. The build tool is not a part of your software, it acts on your software from 'outside'. -There are many open source tools available to help you with build automation, some are written in PHP others aren't. -This shouldn't hold you back from using them, if they're better suited for the specific job. Here are a few examples: +There are many open source tools available to help you with build automation, some are written in PHP others aren't. This shouldn't hold you back from using them, if they're better suited for the specific job. Here are a few examples: -[Phing](http://www.phing.info/) is the easiest way to get started with automated deployment in the PHP world. -With Phing you can control your packaging, deployment or testing process from within a simple XML build file. -Phing (which is based on [Apache Ant](http://ant.apache.org/)) provides a rich set of tasks usually needed to install or -update a web app and can be extended with additional custom tasks, written in PHP. +[Phing](http://www.phing.info/) is the easiest way to get started with automated deployment in the PHP world. With Phing you can control your packaging, deployment or testing process from within a simple XML build file. Phing (which is based on [Apache Ant](http://ant.apache.org/)) provides a rich set of tasks usually needed to install or update a web app and can be extended with additional custom tasks, written in PHP. -[Capistrano](https://github.com/capistrano/capistrano/wiki) is a system for *intermediate-to-advanced programmers* -to execute commands in a structured, repeatable way on one or more remote machines. -It is pre-configured for deploying Ruby on Rails applications, however people are **successfully deploying PHP systems** -with it. Successful use of Capistrano depends on a working knowledge of Ruby and Rake. +[Capistrano](https://github.com/capistrano/capistrano/wiki) is a system for *intermediate-to-advanced programmers* to execute commands in a structured, repeatable way on one or more remote machines.It is pre-configured for deploying Ruby on Rails applications, however people are **successfully deploying PHP systems** with it. Successful use of Capistrano depends on a working knowledge of Ruby and Rake. -Dave Gardner's blog post [PHP Deployment with Capistrano](http://www.davegardner.me.uk/blog/2012/02/13/php-deployment-with-capistrano/) -is a good starting point for PHP developers interested in Capistrano. +Dave Gardner's blog post [PHP Deployment with Capistrano](http://www.davegardner.me.uk/blog/2012/02/13/php-deployment-with-capistrano/) is a good starting point for PHP developers interested in Capistrano. -[Chef](http://www.opscode.com/chef/) is more than a deployment framework, it is a very powerful Ruby based system -integration framework that doesn't just deploy your app but can build your whole server environment or virtual boxes. +[Chef](http://www.opscode.com/chef/) is more than a deployment framework, it is a very powerful Ruby based system integration framework that doesn't just deploy your app but can build your whole server environment or virtual boxes. Chef resources for PHP developers: @@ -55,16 +42,11 @@ Further reading: ### Continuous Integration -> Continuous Integration is a software development practice where members of a team integrate their work frequently, -usually each person integrates at least daily — leading to multiple integrations per day. Many teams find that this -approach leads to significantly reduced integration problems and allows a team to develop cohesive software more rapidly. +> Continuous Integration is a software development practice where members of a team integrate their work frequently, usually each person integrates at least daily — leading to multiple integrations per day. Many teams find that this approach leads to significantly reduced integration problems and allows a team to develop cohesive software more rapidly. *Martin Fowler* -There are different ways to implement continuous integration for PHP. Recently [Travis CI](https://travis-ci.org/) has -done a great job of making continuous integration a reality even for small projects. Travis CI is a hosted continuous -integration service for the open source community. It is integrated with GitHub and offers first class support for many -languages including PHP. +There are different ways to implement continuous integration for PHP. Recently [Travis CI](https://travis-ci.org/) has done a great job of making continuous integration a reality even for small projects. Travis CI is a hosted continuous integration service for the open source community. It is integrated with GitHub and offers first class support for many languages including PHP. Further reading: From 8b7b2ae5562d4cc77b516ed6b628d084fd2688ae Mon Sep 17 00:00:00 2001 From: Sean DuBois Date: Wed, 5 Dec 2012 22:58:44 -0500 Subject: [PATCH 14/22] Update password hashing section --- .../07-03-01-Password-Hashing-with-Bcrypt.md | 19 -------- _posts/07-03-01-Password-Hashing.md | 44 +++++++++++++++++++ 2 files changed, 44 insertions(+), 19 deletions(-) delete mode 100644 _posts/07-03-01-Password-Hashing-with-Bcrypt.md create mode 100644 _posts/07-03-01-Password-Hashing.md diff --git a/_posts/07-03-01-Password-Hashing-with-Bcrypt.md b/_posts/07-03-01-Password-Hashing-with-Bcrypt.md deleted file mode 100644 index bb8471c..0000000 --- a/_posts/07-03-01-Password-Hashing-with-Bcrypt.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -isChild: true ---- - -## Password Hashing with Bcrypt {#password_hashing_with_bcrypt_title} - -Eventually everyone builds a PHP application that relies on user login. Usernames and (hashed) passwords are stored in a database and later used to authenticate users upon login. - -It is important that you properly _hash_ passwords that are stored in a database. If passwords are not hashed, and your database is hacked or accessed by an unauthorized third-party, all user accounts are now compromised. - -**Hash passwords with Bcrypt**. It's super simple, and (for all intents and purposes) Bcrypt makes it impossible for someone to reverse-engineer the plain-text version of a password should the database be compromised. - -There are several Bcrypt libraries for PHP that you may use. - -* [Read "How to Safely Store a Password" by Coda Hale][3] -* [Use Bcrypt with PHPass][4] - -[3]: http://codahale.com/how-to-safely-store-a-password/ -[4]: http://www.openwall.com/phpass/ diff --git a/_posts/07-03-01-Password-Hashing.md b/_posts/07-03-01-Password-Hashing.md new file mode 100644 index 0000000..8d3d03a --- /dev/null +++ b/_posts/07-03-01-Password-Hashing.md @@ -0,0 +1,44 @@ +--- +isChild: true +--- + +## Password Hashing {#password_hashing_title} + +Eventually everyone builds a PHP application that relies on user login. Usernames and passwords are stored in a database and later used to authenticate users upon login. + +It is important that you properly [_hash_][3] passwords before storing them. Password hashing is an irreversible, one way function performed against the users password. This produces a fix length string that can not be feasibly reversed. This means you can compare a hash against another to determine if they both came from the same source string, but you can not determine the original string. If passwords are not hashed and your database is accessed by an unauthorized third-party, all user accounts are now compromised. Some users may (unfortunately) use the same password for other services. Therefore, it is important to take security seriously. + +**Hashing passwords with `password_hash`** + +In PHP 5.5 `password_hash` will be introduced. At this time it is using BCrypt, the strongest algorithm currently supported by PHP. It will updated in the future to support more algorithms as needed though. The `password_compat` library was created to provide forward compatibility for PHP >= 5.3.7. + +Below we hash two strings, but because the two hashes do not match the user will be denied login. + +{% highlight php %} += 5.3.7 && < 5.5] [2] +* [Learn about hashing in regards to cryptography] [3] +* [PHP `password_hash` RFC] [4] + +[1]: http://us2.php.net/manual/en/function.password-hash.php +[2]: https://github.com/ircmaxell/password_compat +[3]: http://en.wikipedia.org/wiki/Cryptographic_hash_function +[4]: https://wiki.php.net/rfc/password_hash From 6d62e643f7a75dff69c4cf42edaaf04bf1961cdb Mon Sep 17 00:00:00 2001 From: Sean DuBois Date: Thu, 6 Dec 2012 04:44:29 -0500 Subject: [PATCH 15/22] The example I had before is not actually helpful for users, this one is much more relevant --- _posts/07-03-01-Password-Hashing.md | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/_posts/07-03-01-Password-Hashing.md b/_posts/07-03-01-Password-Hashing.md index 8d3d03a..cb611bf 100644 --- a/_posts/07-03-01-Password-Hashing.md +++ b/_posts/07-03-01-Password-Hashing.md @@ -12,20 +12,16 @@ It is important that you properly [_hash_][3] passwords before storing them. Pas In PHP 5.5 `password_hash` will be introduced. At this time it is using BCrypt, the strongest algorithm currently supported by PHP. It will updated in the future to support more algorithms as needed though. The `password_compat` library was created to provide forward compatibility for PHP >= 5.3.7. -Below we hash two strings, but because the two hashes do not match the user will be denied login. +Below we hash a string, we then check the hash against a new string. Because our two source strings are different ('secret-password' vs. 'bad-password') this login will fail. {% highlight php %} Date: Sun, 9 Dec 2012 20:52:59 +0100 Subject: [PATCH 16/22] Adding more information about vagrant, extracting it into it's own section --- _posts/01-05-01-Windows-Setup.md | 7 ------- _posts/01-06-01-Vagrant.md | 22 ++++++++++++++++++++++ 2 files changed, 22 insertions(+), 7 deletions(-) create mode 100644 _posts/01-06-01-Vagrant.md diff --git a/_posts/01-05-01-Windows-Setup.md b/_posts/01-05-01-Windows-Setup.md index 1cd34ab..c6430bf 100644 --- a/_posts/01-05-01-Windows-Setup.md +++ b/_posts/01-05-01-Windows-Setup.md @@ -17,10 +17,6 @@ If you need to run your production system on Windows then IIS7 will give you the to go, you just need to configure PHP as a handler. For support and additional resources there is a [dedicated area on iis.net][php-iis] for PHP. -Generally running your application on different environment in development and production can lead to strange bugs popping up when you go -live. If you are developing on Windows and deploying to Linux (or anything non-Windows) then you should consider using a Virtual Machine. This -sounds tricky, but using [Vagrant][vagrant] you can set up simple wrappers, then using [Puppet][puppet] or [Chef][chef] you can provision these boxes and share them with your colleagues to ensure you're all working on the same stack. More on this soon. - [php-downloads]: http://windows.php.net [phpmanager]: http://phpmanager.codeplex.com/ [wpi]: http://www.microsoft.com/web/downloads/platform.aspx @@ -28,6 +24,3 @@ sounds tricky, but using [Vagrant][vagrant] you can set up simple wrappers, then [xampp]: http://www.apachefriends.org/en/xampp.html [wamp]: http://www.wampserver.com/ [php-iis]: http://php.iis.net/ -[vagrant]: http://vagrantup.com/ -[puppet]: http://www.puppetlabs.com/ -[chef]: http://www.opscode.com/ diff --git a/_posts/01-06-01-Vagrant.md b/_posts/01-06-01-Vagrant.md new file mode 100644 index 0000000..9f824f8 --- /dev/null +++ b/_posts/01-06-01-Vagrant.md @@ -0,0 +1,22 @@ +--- +isChild: true +--- + +## Vagrant {#vagrant_title} + +Running your application on different environments in development and production can lead to strange bugs +popping up when you go live. It's also tricky to keep different development environments up to date with the same +version for all libraries used when working with a team of developers. + +If you are developing on Windows and deploying to Linux (or anything non-Windows) or are developing in a team, you +should consider using a virtual machine. This sounds tricky, but using [Vagrant][vagrant] you can set up a simple +virtual machine with only a few steps. This so called "base boxes" can then be set up with different software +using either [Puppet][puppet] or [Chef][chef] (This is called provisioning). If you share those setup files with your +colleagues you can ensure you're all working on the same stack. + +Vagrant creates shared folders used to share your code between your host and your virtual machine, meaning you can +create and edit your files on your host machine and then run the code inside your virtual machine. + +[vagrant]: http://vagrantup.com/ +[puppet]: http://www.puppetlabs.com/ +[chef]: http://www.opscode.com/ From bdbace15413b2b64337a5838a846fa1f8b5e2ce8 Mon Sep 17 00:00:00 2001 From: Jeremy Cloutier Date: Sun, 9 Dec 2012 16:13:22 -0500 Subject: [PATCH 17/22] replaced line breaks and added block quote markup for multiple lines of the fowler quote --- _posts/09-05-01-Building your Application.md | 33 +++++++++++++++----- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/_posts/09-05-01-Building your Application.md b/_posts/09-05-01-Building your Application.md index bccdc16..ceb50f8 100644 --- a/_posts/09-05-01-Building your Application.md +++ b/_posts/09-05-01-Building your Application.md @@ -4,7 +4,11 @@ isChild: true ## Building and Deploying your Application {#build_title} -If you find yourself doing manual database schema changes or running your tests manually before updating your files (manually), think twice! With every additional manual task needed to deploy a new version of your app, the chances for potentially fatal mistakes increase. Whether you're dealing with a simple update, a comprehensive build process or even a continuous integration strategy, [build automation](http://en.wikipedia.org/wiki/Build_automation) is your friend. +If you find yourself doing manual database schema changes or running your tests manually before updating your files +(manually), think twice! With every additional manual task needed to deploy a new version of your app, the chances for +potentially fatal mistakes increase. Whether you're dealing with a simple update, a comprehensive build process or +even a continuous integration strategy, [build automation](http://en.wikipedia.org/wiki/Build_automation) is your +friend. Among the tasks you might want to automate are: @@ -18,17 +22,27 @@ Among the tasks you might want to automate are: ### Build Automation Tools -Build tools can be described as a collection of scripts that handle common tasks of software deployment. The build tool is not a part of your software, it acts on your software from 'outside'. +Build tools can be described as a collection of scripts that handle common tasks of software deployment. The build +tool is not a part of your software, it acts on your software from 'outside'. -There are many open source tools available to help you with build automation, some are written in PHP others aren't. This shouldn't hold you back from using them, if they're better suited for the specific job. Here are a few examples: +There are many open source tools available to help you with build automation, some are written in PHP others aren't. +This shouldn't hold you back from using them, if they're better suited for the specific job. Here are a few examples: -[Phing](http://www.phing.info/) is the easiest way to get started with automated deployment in the PHP world. With Phing you can control your packaging, deployment or testing process from within a simple XML build file. Phing (which is based on [Apache Ant](http://ant.apache.org/)) provides a rich set of tasks usually needed to install or update a web app and can be extended with additional custom tasks, written in PHP. +[Phing](http://www.phing.info/) is the easiest way to get started with automated deployment in the PHP world. With +Phing you can control your packaging, deployment or testing process from within a simple XML build file. Phing (which +is based on [Apache Ant](http://ant.apache.org/)) provides a rich set of tasks usually needed to install or update a +web app and can be extended with additional custom tasks, written in PHP. -[Capistrano](https://github.com/capistrano/capistrano/wiki) is a system for *intermediate-to-advanced programmers* to execute commands in a structured, repeatable way on one or more remote machines.It is pre-configured for deploying Ruby on Rails applications, however people are **successfully deploying PHP systems** with it. Successful use of Capistrano depends on a working knowledge of Ruby and Rake. +[Capistrano](https://github.com/capistrano/capistrano/wiki) is a system for *intermediate-to-advanced programmers* to +execute commands in a structured, repeatable way on one or more remote machines.It is pre-configured for deploying +Ruby on Rails applications, however people are **successfully deploying PHP systems** with it. Successful use of +Capistrano depends on a working knowledge of Ruby and Rake. -Dave Gardner's blog post [PHP Deployment with Capistrano](http://www.davegardner.me.uk/blog/2012/02/13/php-deployment-with-capistrano/) is a good starting point for PHP developers interested in Capistrano. +Dave Gardner's blog post [PHP Deployment with Capistrano](http://www.davegardner.me.uk/blog/2012/02/13/php-deployment-with-capistrano/) +is a good starting point for PHP developers interested in Capistrano. -[Chef](http://www.opscode.com/chef/) is more than a deployment framework, it is a very powerful Ruby based system integration framework that doesn't just deploy your app but can build your whole server environment or virtual boxes. +[Chef](http://www.opscode.com/chef/) is more than a deployment framework, it is a very powerful Ruby based system +integration framework that doesn't just deploy your app but can build your whole server environment or virtual boxes. Chef resources for PHP developers: @@ -42,7 +56,10 @@ Further reading: ### Continuous Integration -> Continuous Integration is a software development practice where members of a team integrate their work frequently, usually each person integrates at least daily — leading to multiple integrations per day. Many teams find that this approach leads to significantly reduced integration problems and allows a team to develop cohesive software more rapidly. +> Continuous Integration is a software development practice where members of a team integrate their work frequently, +> usually each person integrates at least daily — leading to multiple integrations per day. Many teams find that this +> approach leads to significantly reduced integration problems and allows a team to develop cohesive software more +> rapidly. *Martin Fowler* From 85c8cb1212539165db4d7e8c02d4edd14d20154d Mon Sep 17 00:00:00 2001 From: Phil Sturgeon Date: Sun, 9 Dec 2012 16:21:48 -0500 Subject: [PATCH 18/22] Fixed formatting for last PR --- _posts/09-05-01-Building your Application.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/_posts/09-05-01-Building your Application.md b/_posts/09-05-01-Building your Application.md index ceb50f8..d0708b1 100644 --- a/_posts/09-05-01-Building your Application.md +++ b/_posts/09-05-01-Building your Application.md @@ -34,7 +34,7 @@ is based on [Apache Ant](http://ant.apache.org/)) provides a rich set of tasks u web app and can be extended with additional custom tasks, written in PHP. [Capistrano](https://github.com/capistrano/capistrano/wiki) is a system for *intermediate-to-advanced programmers* to -execute commands in a structured, repeatable way on one or more remote machines.It is pre-configured for deploying +execute commands in a structured, repeatable way on one or more remote machines. It is pre-configured for deploying Ruby on Rails applications, however people are **successfully deploying PHP systems** with it. Successful use of Capistrano depends on a working knowledge of Ruby and Rake. @@ -61,9 +61,12 @@ Further reading: > approach leads to significantly reduced integration problems and allows a team to develop cohesive software more > rapidly. -*Martin Fowler* +*-- Martin Fowler* -There are different ways to implement continuous integration for PHP. Recently [Travis CI](https://travis-ci.org/) has done a great job of making continuous integration a reality even for small projects. Travis CI is a hosted continuous integration service for the open source community. It is integrated with GitHub and offers first class support for many languages including PHP. +There are different ways to implement continuous integration for PHP. Recently [Travis CI](https://travis-ci.org/) has +done a great job of making continuous integration a reality even for small projects. Travis CI is a hosted continuous +integration service for the open source community. It is integrated with GitHub and offers first class support for many +languages including PHP. Further reading: From 871b53f2c72473a8b751f7ac1f7e4ad3eee416c5 Mon Sep 17 00:00:00 2001 From: Sebastian Goettschkes Date: Mon, 10 Dec 2012 10:22:56 +0100 Subject: [PATCH 19/22] Doing some improvements to the vagrant section as suggested by @philsturgeon --- _posts/01-06-01-Vagrant.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/_posts/01-06-01-Vagrant.md b/_posts/01-06-01-Vagrant.md index 9f824f8..9503f95 100644 --- a/_posts/01-06-01-Vagrant.md +++ b/_posts/01-06-01-Vagrant.md @@ -10,9 +10,11 @@ version for all libraries used when working with a team of developers. If you are developing on Windows and deploying to Linux (or anything non-Windows) or are developing in a team, you should consider using a virtual machine. This sounds tricky, but using [Vagrant][vagrant] you can set up a simple -virtual machine with only a few steps. This so called "base boxes" can then be set up with different software -using either [Puppet][puppet] or [Chef][chef] (This is called provisioning). If you share those setup files with your -colleagues you can ensure you're all working on the same stack. +virtual machine with only a few steps. These base boxes can then be set up manually, or you can use "provisioning" +software such as [Puppet][puppet] or [Chef][chef] to do this for you. Provisioning the base box is a great way to +ensure that multiple boxes are set up in an identical fashion and removes the need for you to maintain complicated +"set up" command lists. You can also "destroy" your base box and recreate it without many manual steps, making it +easy to create a "fresh" installation. Vagrant creates shared folders used to share your code between your host and your virtual machine, meaning you can create and edit your files on your host machine and then run the code inside your virtual machine. From 3cbb0ba99651f081ce1401604701997f8a0ad453 Mon Sep 17 00:00:00 2001 From: Leif Arne Storset Date: Tue, 11 Dec 2012 21:43:07 +0100 Subject: [PATCH 20/22] Clarify global-namespace explanation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I had trouble understanding this passage, but a peek in the documentation explained it. It's not about "execution" – the execution of the function is unaffected – it's about name resolution. And it's also not really about "definition". While I was at it, I renamed "method" to function, as these are not methods and methods aren't really affected by namespaces (they're already namespaced by a class). Also copyedited a bit. --- pages/The-Basics.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pages/The-Basics.md b/pages/The-Basics.md index 092ce58..b905277 100644 --- a/pages/The-Basics.md +++ b/pages/The-Basics.md @@ -104,8 +104,8 @@ function test($a) ## Global namespace -While using namespaces, you may find your code being executed in the wrong scope for internal methods. To fix this, -define the method globally by using a backslash before the method. +When using namespaces, you may find that internal functions are hidden by functions you wrote. To fix this, +refer to the global function by using a backslash before the function name. {% highlight php %} Date: Fri, 14 Dec 2012 22:50:43 +0000 Subject: [PATCH 21/22] Fixed typos --- _posts/02-01-01-Code-Style-Guide.md | 2 +- _posts/03-02-01-Programming-Paradigms.md | 2 +- _posts/06-01-01-Databases.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/_posts/02-01-01-Code-Style-Guide.md b/_posts/02-01-01-Code-Style-Guide.md index f5a501d..b83e831 100644 --- a/_posts/02-01-01-Code-Style-Guide.md +++ b/_posts/02-01-01-Code-Style-Guide.md @@ -12,7 +12,7 @@ Lithium, etc are starting to adopt. You can use them for your own projects, or c Ideally you should write PHP code that adheres to one or more of these standards so that other developers can easily read and work with your code, and applications that implement the components can have consistency even when working with -lots of third-party code. The first few recommendations are designed to be a super-set of the previous recomendation. +lots of third-party code. The first few recommendations are designed to be a super-set of the previous recommendation. * [Read about PSR-0][psr0] * [Read about PSR-1][psr1] diff --git a/_posts/03-02-01-Programming-Paradigms.md b/_posts/03-02-01-Programming-Paradigms.md index 57958d1..eb0d567 100644 --- a/_posts/03-02-01-Programming-Paradigms.md +++ b/_posts/03-02-01-Programming-Paradigms.md @@ -11,7 +11,7 @@ the years, notably adding a solid object-oriented model in PHP 5.0 (2004), anony ### Object-oriented Programming PHP has a very complete set of object-oriented programming features including support for classes, abstract classes, -interfaces, inheritence, constructors, cloning, exceptions, and more. +interfaces, inheritance, constructors, cloning, exceptions, and more. * [Read about Object-oriented PHP][oop] * [Read about Traits][traits] diff --git a/_posts/06-01-01-Databases.md b/_posts/06-01-01-Databases.md index 2df1624..bf20ecb 100644 --- a/_posts/06-01-01-Databases.md +++ b/_posts/06-01-01-Databases.md @@ -13,7 +13,7 @@ database — and that can get silly. As an extra note on native drivers, the mysql extension for PHP is no longer in active development, and the official status since PHP 5.4.0 is "Long term deprecation". This means it will be removed within the next few releases, so by PHP 5.6 (or whatever comes after 5.5) it may well be gone. If you are using `mysql_connect()` and `mysql_query()` in your applications then you will be faced with a rewrite at some point down the -line, so the best option is to replace mysql usage with mysqli or PDO in your applications within your own development shedules so you won't +line, so the best option is to replace mysql usage with mysqli or PDO in your applications within your own development schedules so you won't be rushed later on. _If you are starting from scratch then absolutely do not use the mysql extension: use the [MySQLi extension][mysqli], or use PDO._ * [PHP: Choosing an API for MySQL](http://php.net/manual/en/mysqlinfo.api.choosing.php) From f03a14bcb50ec934c91d955087715a3a78d90e5d Mon Sep 17 00:00:00 2001 From: maliayas Date: Sun, 16 Dec 2012 06:32:52 +0200 Subject: [PATCH 22/22] Fixed typo with variable name. --- _posts/07-03-01-Password-Hashing.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/_posts/07-03-01-Password-Hashing.md b/_posts/07-03-01-Password-Hashing.md index cb611bf..1047368 100644 --- a/_posts/07-03-01-Password-Hashing.md +++ b/_posts/07-03-01-Password-Hashing.md @@ -18,9 +18,9 @@ Below we hash a string, we then check the hash against a new string. Because our