Cli app to (filter, sort and display filtered) hotels from an api
- Symfony-console for reading user input and displaying output
- Guzzle for making Http requests
- Carbon for dates parsing and manipulation
- php-unit for unit testing purposes
- Psr-4 autoloading
- Psr-2 coding style
-
Clone the repository
$ git clone https://github.com/abdelrahmanrafaat/Tajawal-Interview-Task.git . -
Install the app dependencies(php and composer are required to run this)
$ composer install
-The app entry point is a file named tajawal this files includes the autoloading and app bootstraping
-
the command to start the application
$ php tajawal find:hotels
the command acceptes an optional -s flag for sorting criteria (sorting by price or name)
$ php tajawal find:hotels -s price
-
once you run the command you will be asked to enter the search keys you want to filter by
name city price availability at least one or more seperated by ,
$ name,city,price,availability -
for every search key you selected you will be asked to enter it`s values
-for example: hotel names can be (multiple names seperated by a comma ",")
$ rotana,helton
-hotel cities can be (multiple cities seperated by a comma ",")
$ cairo,dubai
-hotel price can be (numeric_number:numerice_number) only one range is accepted
$ 50:200
-hotel avaialbilites can be dates Ranges seperated by Comma, Dates should be on the format d-m-Y
$ 1-10-2018:10-10-2018,1-5-2018:10-5-2018
At the end the matching hotels will be displayed with it`s price
$ ./vendor/bin/phpunit
- Instead of using general exceptions, create custom exceptions classes
- Large data-set should be paginated
- Adding a Caching layer that can be updated by a scheduled job to save request time while the user is using the app
- Normalizing the data returned from the api for example: remove word Hotel from Rotana Hotel to be Rotana
- benchmarking/profiling filtering and sorting algorthims and Implementing a more effiecient ones