API to split a list of properties between two Real State Companies (CompanyOne and Company Two) following some rules.
- PHP 7.2
- PHPUnit 8
- Docker
- Docker Compose
Due to its simplicity, this project was created without using a PHP framework. Instead, only a few packages were used for specific needs:
- Coffeecode Router
- PHPDotEnv
Copy content of file .env.example into a new file .env.
Execute the following command in the project root directory:
$ docker-compose up -d
The installation of the dependencies is done when docker is initialized. Therefore, there is no need to do this procedure manually.
To execute the unit tests, with the containers running, just use the following command:
$ docker-compose run tests
To execute any action in the composer, use the following command pattern:
$ docker run --rm --interactive --tty \
--volume $PWD:/app \
composer <command>
List properties of each company:
/properties/portal/{companyone|companytwo}/{pagenumber}
List all properties:
/properties/{pagenumber}
- At the first time the json at REMOTE_FILE_PATH is consulted, a copy of its content will be stored in the application. In the nexts properties consults, the application will use the local copy instead of the remote one aiming for better performance.
- Use Chain of Responsabilities design pattern to define wich collection should be loaded in the getPropertiesCollection method;
- Check the request eTag for the remote file to define if the local version should be updated.