On this page you will learn how to configure:
The configuration is entirely handled by the Laravel framework, if you encounter things that aren't covered on this page, visit the Laravel configuration documentation or if that doesn't help you out, get in touch with us on github.
Ideally, you don't change any files in the app/config directory, but copy them into a folder you create under app/config and then edit as you see fit. This allows for proper configuration management and will make your overall configuration flow alot easier. For more info on this, check out the configuration documentation.
The sections below are a summary of what the important parts of the configuration are.
You'll find that configuring an application through the Laravel framework is really easy and straightforward. Head to the root of the application and go to app/config. The explanation below is the same for environment configurations such as production. Simply create a folder under app/config called production and copy the files you want to change. This should also be explained thoroughly in the configuration documentation of Laravel.
In the configuration folder you'll find a set of php files and folders that make up one or more configurations. The one that has to be changed is called database.php
The codebase has been tested against a MySQL database, it uses the Eloquent abstraction layer, so any database supported by Eloquent you should be able to use. As an example we'll use MySQL as a default so change the default property to mysql and fill in the mysql entry in the connections array in the database.php file. There's no need to throw away the other connection options or change anything else. This should make your database.php file look something like the following. Note that the comments that are present from a default Laravel installation have been deleted for the sake of simplicity.
return array( 'fetch' => PDO::FETCH_CLASS, 'default' => 'mysql', 'connections' => array( 'sqlite' => array( 'driver' => 'sqlite', 'database' => __DIR__.'/../database/production.sqlite', 'prefix' => '', ), 'mysql' => array( 'driver' => 'mysql', 'host' => 'localhost', 'database' => 'datatank_db', 'username' => 'foo', 'password' => 'bar', 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '', ), 'pgsql' => array( 'driver' => 'pgsql', 'host' => 'localhost', 'database' => 'database', 'username' => 'root', 'password' => '', 'charset' => 'utf8', 'prefix' => '', 'schema' => 'public', ), 'sqlsrv' => array( 'driver' => 'sqlsrv', 'host' => 'localhost', 'database' => 'database', 'username' => 'root', 'password' => '', 'prefix' => '', ), ), ...
That's all there is to it!
The data request made to The DataTank are cached using the Laravel caching mechanism. For the datatank we use the Memcached to cache all of our requests and internal flags. So be sure to have it running and configured in a way that PHP can reach it.
Head to the cache.php file and make sure that the default driver is set to memcached and fill in the necessary properties like so
'enabled' => true, 'driver' => 'memcached', ... 'memcached' => array( array('host' => '127.0.0.1', 'port' => 11211, 'weight' => 100), ), ...
If you're planning on getting your hands dirty with The DataTank, you'll need to read up on how to configure environments in the Laravel configuration documentation. In short, in order to load your database for development (e.g. localhost) only, you need to create a subfolder called local in the app/config folder, and make sure the environment is recognized by Laravel. This is done by adding your host name to the $env variable in the bootstrap/start.php file. Don't forget to add this file to the .gitignore file if you're using Git.
If you want to run the unittests, to check if everything is still ok after adjustments or to test your own additional tests, go to the root of the application and perform the simple command:
This will execute all of the tests located at the app/tests folder.
If you've never performed the unit tests before, you will probably stumble upon a large series of errors. This is because the testing environment hasn't been configured yet. It is however a fairly simple thing to do.
First you'll need to create a database that will be used by the unit tests. This can be configured in the database.php file inside the app/config/testing folder. Next you'll want to create the necessary tables in order to create a similar back-end as the application uses, in order to do this you'll need to perform the migration command, but with the testing environment as a parameter.
$ php artisan migrate --env=testing
Next, you'll have to migrate the extra package that we use for authentication purposes as well:
$ php artisan migrate --env=testing --package=cartalyst/sentry
After that, fill up the database with some basic users using our seeder:
$ php artisan db:seed --env=testing
That's it! You can perform the phpunit command now.