Database Reference
In-Depth Information
Composer
The project in this chapter also makes use of Composer, which is a tool for dependency management in PHP.
Composer allows you to explicitly declare any of the PHP libraries your project needs and then installs them in your
project for you. This is a huge benefit when your application depends upon one or more PHP libraries, which is the
case with the sample application in this chapter and will probably be the case with most of your PHP projects.
Tip
To download Composer and get information about installing it, go to https://getcomposer.org/ .
Even though the sample project in this chapter has all of the dependencies already set, you should take some
time and become familiar with Composer and how to use it in your projects. The example in Listing 8-1 shows the
contents of the Composer file that is included within this project.
Listing 8-1. composer.json file for the sample project
{
"name": "slim/slim-skeleton",
"description": "A Slim Framework skeleton application for rapid development",
"keywords": ["microframework","rest","router"],
"homepage": " http://github.com/codeguy/Slim-Skeleton " ,
"license": "MIT",
"authors": [
{
"name": "Josh Lockhart",
"email": "info@joshlockhart.com",
"homepage": " http://www.joshlockhart.com/ "
}
],
"require": {
"php": ">=5.3.0",
"monolog/monolog": "1.*",
"slim/slim": "2.*",
"slim/views": "0.1.*",
"twig/twig": "1.*",
"everyman/neo4jphp": "dev-master"
}
}
The first section contains meta-information about the project, but the most important section is the require key/
value section. The require section shows the specific dependencies for the project. Once Composer is installed and
you have added a composer.json file to the root of your project, you can execute the command in Listing 8-2. The
example in Listing 8-2 assumes that you have installed Composer using the global installation method.
Listing 8-2. Creating a project with Composer
// Replace [my-neo4j-app] with the desired directory name or path for your new application.
composer create-project slim/slim-skeleton [my-neo4j-app]
 
 
Search WWH ::




Custom Search