Displaying EURO 2016 data with PHPRunner

PHP, PHP Code Generator, PHP Form Generator, Tutorials

This is a just for fun PHPRunner project similar to one we built for World Cup 2014. Check this live demo first.

This project requires PHPRunner 9.0. Yes, there is a desktop app for this project. Download it, install it, run it and enjoy. Ignore the security warning, we didn’t sign this one yet.

This project uses live Euro 2016 data provided by football-data.org in JSON format. PHPRunner project makes the use of this data and if will not work if they website is down for any reason.

Download and setup instructions

1. This project requires PHPRunner 9.0 and MySQL database. Download project, unzip it, run euro2016.sql script against your MySQL database. The actual data will be coming from football-data.org but you still need to create this table in your database.

2. If you want to play with this project request a free API key. Without this key you will be limited to 50 requests per day.

$_SESSION["authToken"]='Your API token here';

3. Change the database connection to point it to your database.

4. Go to AfterAppInit event and paste your API key there.

5. Change output folder location (‘Output directory’ screen).

6. Build, view in web browser and enjoy. To reduce the number requests to football-data.org we cache JSON data in session variables so you won’t see realtime updates.

A few notes on project setup

Data is not coming from the database but from a third party website in JSON format. If you ever wondered how PHPRunner can consume data from third party web services check this project events.

  • AfterAppInit – this where we retrieve, parse data and store it in session variables for later use
  • List page: Custom Query – this is where we prepare an array with results to be displayed. See how URL parameters like show=today or show=tomorrow are handled
  • List page: After record processed – here we change the background color of today’s matches
  • List page: Javascript OnLoad event – here we make the whole row on the list page clickable pointing itto the View page
  • View page: Process record values – here we retrieve one record from our array of matches based on match number passed via URL.

Feel free to ask your questions in comments

3 thoughts on “Displaying EURO 2016 data with PHPRunner

Leave a Reply

Your email address will not be published. Required fields are marked *