Installing Propel in our project via Composer
Let's pull Propel2 ORM into our project using Composer. Let's take a look at the related packages needed for Propel2.
Having understood the basic commands and the basics of how to work with Composer , we can begin to integrate it into our project.
Our project :
The project will have this simple structure for example
It will only contain the index.php file. The rest is already created by Composer itself.
What do we connect :
For example, let's include symfony/var-dumper from Symfony. Our /var/www/proj.loc/composer.json looks like this:
{
"name": "username/proj.loc",
"description": "Description",
"type": "proj.loc",
"license": "free",
"authors": [
{
"name": "username",
"email": "ad@min.loc"
}
],
"require": {
"symfony/var-dumper": "^2.0"
}
}
We do in the root of the project /var/www/proj.loc/ :
composer install
this creates a vendor folder. We need her. It will contain autoload.php .
We connect :
In the index.php file we place the autoload.php connection
<?php
include_once './vendor/autoload.php';
dump($_SERVER);>
If everything went well, then from the library pulled through Composer, the dump () function will become available;
Let's pull Propel2 ORM into our project using Composer. Let's take a look at the related packages needed for Propel2.
Composer brought the convenience of using ready-made solutions, packages and libraries. Proper organization of work with Composer can make it easy to maintain always up-to-date versions of the libraries used in the project. Consider getting started with Composer.