Displays the top ten movies on IMDB. The application progressively builds an arhive with the top ten movies for a particular date.
It is based on the Yii2 framework.
- PHP > 5.4.0
- php5-curl
- Composer. If you do not have Composer, you can run
the following commands on Linux and Mac OS X:
curl -s http://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer
- cron
- Clone the repository
- Run
composer global require "fxp/composer-asset-plugin:1.0.0-beta3"
. Installs the composer asset plugin which allows managing bower and npm package dependencies through Composer. You only need to run this command once for all. - Run
composer install
in the root directory of the application in order to install dependencies. This will create the vendor directory with all package dependencies inlcuding the yii core source code. - Create a new database with the name
imdbdb
and a new userimdbuser
with passwordpassword1!
(or edit the fileconfig/db.php
and give your own database name, user and password). - Run
./yii migrate
in the root directory to create the database tables. - Run
./yii imdbscraper/storerecords
in the root directory to make an initial call to imdb and store the top ten movies for the current date. - Create a cron job to execute the above script every day or week.
- You can use php build-in web server. Run
php -S localhost:8000
from the root directory. - Point your browser to
http://localhost:8000/web
.
- It uses a scraper script (
commands/ImdbscraperController.php
) to fetch the IMDB charts page in order to get the top movies . - The top 10 movies are stored in the database.
- The scraper script runs every day or week (it depends on the cron job setup) to get the top movies for the current date.
- A user selects an available date from the dropdown menu to get the top ten movies for that date.
- A caching system prevents the database from being queried each time the data needs to be displayed. The default yii2 caching layer is used which is based on files caching. However, another caching layer could be used like Memcached.