-
Notifications
You must be signed in to change notification settings - Fork 29
Installing
Eustáquio Rangel edited this page Aug 3, 2017
·
7 revisions
Just include the torm.php
file. All the other files TORM needs to work are there.
Change (or create, if needed) your Composer file to include TORM
:
{
"require": {
"taq/torm": ">=1.0"
}
}
Then you're ready to access all the TORM classes:
<?php
require __DIR__ . '/vendor/autoload.php';
var_dump(new TORM\Model());
?>
We need PDO to use TORM. Take a look on the PHP official docs about it, to make it work.
Take a look on the drivers
directory, all the supported databases are there.
We can use 3 environments to store our connections and drivers: development, test and production. We can set the correct environment on some ways:
- Sending the environment name after the PDO connection object:
TORM\Connection::setConnection($con,"test");
- Using an environment variable:
TORM_ENV
; - Or, with Apache, to select the current enviroment, for example, to production, on an Apache server with
.htaccess
allowed, insert into the.htaccess
file:SetEnv TORM_ENV production
Like this:
<?php
TORM\Connection::setConnection($con);
TORM\Connection::setDriver("sqlite");
?>