Project Setup and local configuration - Pariks/smallbackendproject GitHub Wiki

Steps to Follow

Files to look for from being in project root

  1. -index.php //You need to login to fb once to get long lasting access_token
  2. -cronHourlyFanCount.php //It is the main cron to get fan count from fan page
  3. -getFans.php //is api file which returns different format json output like, Linechart, table and multiplepage
  4. -config/config.php //is configuration file where database configuration and fb app is and secret can be set
  5. -databaseExports/ //has two .sql file to be imported into db
    • Note*- Database used here is MySql with Apache server

Here is a simple guide to setup project locally.


  1. Clone repository
  2. Import Tables into database from project root
    • /databaseExports/fb_hourly_fan_count.sql
    • /databaseExports/session.sql
  3. Setup database connection and update config file from project root
    • /config/config.php
  4. Setup fb_app_id and fb_app_secret Note*- For now you can leave this just to run cron
  5. Setup crontab to run every 1 hour
    • 0 * * * * /{path to /}cronHourlyFanCount.php --uri=CocaCola --page_id=40796308305

or you can run from a command prompt by being in project root type * php cronHourlyFanCount.php --uri=CocaCola --page_id=40796308305

 * It will insert into a table with a lastest fan count for fan page CocaCola.
  1. From browser make request to {localhost}getFans.php?page_id=40796308305&format=linechart to see result in json format Note*- Format can be linechart, table or multiplepage