Master branch
The links to Travis and CodeClimate should be updated once the repository transfers
Dev branch
Code Analytics
See the /doc directory for documentation and development notes.
General debug tip: Delete the /app/cache folder if you change routing, database structure, or entity-ORM definitions.
Knowledge of the following topics is needed to work on the server-side iPeer4 code. UBC staff can get access to some nice tutorials on these topics at Lynda.com:
- Git
- PHP
- MySQL (or another relational database)
- Symfony Framework
- RESTful Services & HTTP
Resources for Symfony and main bundles/technologies used in this application:
- The Symfony Book
- DoctrineBundle
- Doctrine ORM
- DoctrineFixturesBundle
- FOSUserBundle
- FOSRestBundle
- JMSSerializerBundle
- JMSSerializer and its annotations
- NelmioApiDocBundle
You will need composer: https://getcomposer.org/
Before developing or running, execute this command from the root of this repo to install the dependencies:
composer install
Once the database is setup (see below), to start/stop the server:
php app/console server:start
php app/console server:stop
Once running, check out the auto-generated api documentation at: http://localhost:8000/api/doc/. Change the port as needed.
For tinkering, you can use the sandbox at /api/doc, a command line HTTP client, or a browser extension (Postman - REST Client is quite nice).
When running for the first time, copy app/config/parameters.yml.dist to app/config/parameters.yml and setup the database credentials.
Also run the following to create the database and tables for you:
php app/console doctrine:database:create
php app/console doctrine:schema:update --force
The tests make use of some "fixture" sample data. To load this into the regular database, run:
php app/console doctrine:fixtures:load
To reset the database and load the fixtures, use the reset shell script (uses the commands above after running doctrine:database:drop --force):
./app/reset
Tests are automatically run at Travis CI: https://travis-ci.org/cisdev2/ipeer4-server
Travis can take a while to run, so manually testing the code as you write is recommend.
Tests can be run with phpunit. They run on a different database (local SQLite), so they don't affect the main one. Change src to a more specific path/file if you want to run a specific test. The -c app loads the Symfony test config file from the app folder:
phpunit -c app src