Skip to main content

Posts

Showing posts with the label ORM

Doctrine 2 Tutorial: Installation and Configuration

In this tutorial, we will look at how to install Doctrine2 in your PHP project. This post will make use of Doctrine2's Composer tool. Installation First, create a directory for your project. mkdir zainabed cd zainabed Now, create a composer.json file. vi composer.json Then, add the following repository information to it . { "require" : { "doctrine/orm" : "*" } } You are now ready to use Composer to install Doctrine, but first you must install Composer on your machine. curl -sS https://getcomposer.org/installer | php To install Doctrine2, run the following command. php composer.phar install Note: Composer generates a "autoload.php" file to help in the autoloading of all PHP classes in the Doctrine2 ORM project. Configuration First, create a configuration file, configuration.php  for Doctrine2 and include  autoload.php  inside it. <?php // configuration.php // In

Subscribe for latest tutorial updates

* indicates required