Search:

Search all manuals
Search this manual
Manual
Couchbase Client Library: PHP 1.1
Community Wiki and Resources
Wiki: PHP Client Library
PHP Client Library
Couchbase Developer Guide 2.0
Couchbase Server Manual 2.0
SDK Forum
Additional Resources
Community Wiki
Community Forums
Couchbase SDKs
Parent Section
2.1 Preparations
Chapter Sections
Chapters

2.1.2. Installing the Application Dependencies

Now that Couchbase Server is ready to use, we need to set up the skeleton of our application. Since we're using composer, all we need to get the dependencies is to create a composer.json file with the following content:

{
  "require": {
    "silex/silex": "1.0.x-dev",
    "twig/twig": ">=1.8,<2.0-dev"
  }
}

Place that file inside the /beersample-php directory of your webroot (depending on your setup, it is often located under /var/www/). We also need to create a few more directories to keep the application organized.

Create directories with the following structure:

/beersample-php
    /templates
        /beers
        /breweries
    /assets
        /css
        /js

We'll fill the template directories later, but the assets can be added immediately. Please locate and download the following JavaScript and CSS files so they are in place. We make use of the fabulous Twitter Bootstrap library to make the application look good without much effort.

Also, we're using pretty URLs in our application. Here is a .htaccess file you can place inside your root directory to make it work properly when using Apache HTTPD. Please refer to the Silex documentation on how to add one for different web servers.

<IfModule mod_rewrite.c>
    Options -MultiViews

    RewriteEngine On
    RewriteBase /beersample-php
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

To install the dependencies, we're now able to run php composer.phar install (or update). It should install all needed dependencies and we're ready to go afterwards:

Loading composer repositories with package information
Installing dependencies
  - Installing twig/twig (v1.11.1)
    Downloading: 100%
...

  - Installing silex/silex (dev-master 0e69dc2)
    Cloning 0e69dc22400293f9364f8b918d008f3f6b634a47

symfony/routing suggests installing symfony/config (2.1.*)
...
Writing lock file
Generating autoload files