From 1c2370b8ee4cb63bf61a7657ea43e5689d4f3d77 Mon Sep 17 00:00:00 2001 From: Wil Moore III Date: Mon, 9 Jul 2012 11:35:11 -0600 Subject: [PATCH 1/8] Added an alternative section for installing Composer manually --- _includes/dependency-management.md | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/_includes/dependency-management.md b/_includes/dependency-management.md index a5c6893..b32659a 100644 --- a/_includes/dependency-management.md +++ b/_includes/dependency-management.md @@ -10,12 +10,32 @@ There are already a lot of PHP libraries that are compatible with Composer, read ### How to Install Composer -You can install Composer locally (in your current working directory) or globally (e.g. /usr/local/bin). Let's assume you want to install Composer locally. From your project's root directory: +You can install Composer locally (in your current working directory; though this is no longer recommended) or globally (e.g. /usr/local/bin). Let's assume you want to install Composer locally. From your project's root directory: > curl -s http://getcomposer.org/installer | php This will download `composer.phar` (a PHP binary archive). You can run this with `php` to manage your project dependencies. Please Note: If you pipe downloaded code directly into an interpreter, please read the code online first to confirm it is safe. +### How to Install Composer (manually) + +Manually installing composer is an advanced technique; however, there are various reasons why a developer might prefer this method vs. using the interactive installation routine. The interactive installation checks your PHP installation to ensure that: + +- a sufficient version of PHP is being used +- `.phar` files can be executed correctly +- certain directory permissions are sufficient +- certain problematic extensions are not loaded +- certain `php.ini` settings are set + +Since a manual installation performs none of these checks, you have to decide whether the trade-off is worth it for you. As such, below is how to obtain Composer manually: + + > curl -s http://getcomposer.org/composer.phar -o $HOME/local/bin/composer ; chmod +x $HOME/local/bin/composer + +`$HOME/local/bin` (or a directory of your choice) should be in your `$PATH` environment variable. This will result in a `composer` command being available. + +When you come across documentation that states to run Composer as `php composer.phar install`, you can substitute that with: + + > composer install + ### How to Define and Install Dependencies First, create a `composer.json` file in the same directory as `composer.phar`. Here's an example that lists [Twig][2] as a project dependency. From eccc6b30982d1103a376891c1ae2d0cb304d656a Mon Sep 17 00:00:00 2001 From: Kris Jordan Date: Mon, 9 Jul 2012 14:29:20 -0400 Subject: [PATCH 2/8] Added 'Getting Started' Section Contains basic information guiding new users toward the latest version of PHP. Moved the CLI web server section into Getting Started because it makes more sense here. Added stubs for windows and mac setups that could certainly be further fleshed out with step-by-step tutorials. --- _includes/getting-started.md | 37 ++++++++++++++++++++++++++++++++ _includes/language-highlights.md | 9 ++------ _layouts/default.html | 8 +++++++ index.html | 3 +++ 4 files changed, 50 insertions(+), 7 deletions(-) create mode 100644 _includes/getting-started.md diff --git a/_includes/getting-started.md b/_includes/getting-started.md new file mode 100644 index 0000000..77a6d8b --- /dev/null +++ b/_includes/getting-started.md @@ -0,0 +1,37 @@ +# Getting Started + +## Use the Current Stable Version (5.4) + +If you are just getting started with PHP make sure to start with the current stable release of [PHP 5.4][php-release]. PHP has made great strides adding powerful [new features](#language_highlights) over the last few years. Don't let the minor version number difference between 5.2 and 5.4 fool you, it represents _major_ improvements. + +## Built-in web server + +You can start learning PHP without the hassle of installing and configuring a full-fledged web server (PHP 5.4 required). To start the server, run the following from your terminal in your project's web root: + + > php -S localhost:8000 + +* [Learn about the built-in, command line web server][cli-server] + +[php-release]: http://www.php.net/downloads.php +[cli-server]: http://www.php.net/manual/en/features.commandline.webserver.php + +## Windows Setup + +You can install PHP on windows from an install executable found on the official [PHP Downloads][php-downloads] page. For a complete Apache, MySQL, and PHP installation check out [WAMP][wamp-installer]. + +* [Read more about the official PHP Windows Installer][windows-installer] + +[php-downloads]: http://www.php.net/downloads.php +[windows-installer]: http://www.php.net/manual/en/install.windows.installer.msi.php +[wamp-installer]: http://www.wampserver.com/ + +## Mac Setup + +OSX comes prepackaged with PHP. As of Mountain Lion, it is _not_ the current stable version of PHP, though. You can get the PHP executable through a number of Mac [package managers][mac-package-managers] or [compile it yourself][mac-compile] (if compiling, be sure to have Xcode, or [this substitution][xcode-gcc-substitution], installed). For a complete Apache, MySQL, and PHP installation check out [MAMP2][mamp-downloads]. + +[mac-package-managers]: http://www.php.net/manual/en/install.macosx.packages.php +[mac-compile]: http://www.php.net/manual/en/install.macosx.compile.php +[xcode-gcc-substitution]: https://github.com/kennethreitz/osx-gcc-installer +[mamp-downloads]: http://www.mamp.info/en/downloads/index.html + +[Back to Top](#top){.top} diff --git a/_includes/language-highlights.md b/_includes/language-highlights.md index 9bcef03..6693d30 100644 --- a/_includes/language-highlights.md +++ b/_includes/language-highlights.md @@ -66,14 +66,9 @@ To run our script, above, from the command line: > php hello.php world Hello, world -### Built-in, command line web server - -Starting with PHP 5.4, you can develop locally on a PHP-enabled web server without the hassle of installing and configuring a full-fledged web server. To start the server, from your web root: - - > php -S localhost:8000 * [Learn about running PHP from the command line][php-cli] - * [Learn about the built-in, command line web server][cli-server] + * [Learn about setting up Windows to run PHP from the command line][php-cli-windows] [Back to Top](#top){.top} @@ -90,5 +85,5 @@ Starting with PHP 5.4, you can develop locally on a PHP-enabled web server witho [cli-options]: http://www.php.net/manual/en/features.commandline.options.php [argc]: http://php.net/manual/en/reserved.variables.argc.php [argv]: http://php.net/manual/en/reserved.variables.argv.php -[cli-server]: http://www.php.net/manual/en/features.commandline.webserver.php [php-cli]: http://php.net/manual/en/features.commandline.php +[php-cli-windows]: http://www.php.net/manual/en/install.windows.commandline.php diff --git a/_layouts/default.html b/_layouts/default.html index a8d3340..677defa 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -29,6 +29,14 @@