This is a football (soccer :) match prediction game with a simple concept - you and your buddies battle it out to see who's best at predicting match final scores. Each player gives score predictions to upcoming matches, and then points are awarded check the Game Flow. There is a Slack integration for notifications on events like standings, results and fixture updates. The application is fetching real-world football fixtures and scores via a free football API (http://api.football-data.org), but custom tournaments can be created from the administration.
The project can be run without issues on both *nix and Windows (Mac OS X, Ubuntu and Windows with LAMP tested :). Check the A to Z wiki article for a step by step guide on how to prepare a 5$ 512MB DigitalOcean Ubuntu LAMP 16.04 droplet for the task.
The major steps needed to set-up Symfony and all the tools (for both development and production):
composer install
- for a basic install you just need username and password for mysql, all are written to app/config/parameters.yml check here for those the advanced parameters.
npm install
(if running on a machine with 0.5/1GB RAM add swap)
bower install
(you may need --allow-root as a parameter if running as sudo)
gulp
We suggest that you setup your web server to use web/
as root directory.
The app has two main environments:
app_dev.php
- can only be accessed locally (from 127.0.0.1, a.k.a. localhost)app.php
/
you are redirected to app.php
(configured in .htaccess
).php bin/console cache:clear --env=prod
(have this in mind if creating a deployment script).php bin/console doctrine:schema:update --force
php bin/console fos:user:create
php bin/console fos:user:promote your-username ROLE_ADMIN
php bin/console fos:user:create
N.B.
After doing any changes on app/config/parameters.yml run php bin/console cache:clear --env=prod
for them to take effect.
mailer_host
, mailer_port
, mailer_user
, mailer_password
- SMTP settings in order to have sending of registration confirmation and password reset emails enabled.
Best practice is to use a transactional mail service, like Mailgun, Amazon SES, etc. We recommend Mailgun as registering an account takes a few minutes and the free tier should be enough. Another option is to use Gmail SMTP settings.
football_api.token
- you can get one free from football-data.org. If you use the service for a longer time, consider donating :)
slack.url, slack.channel
- Generate them in Slack in order to get notifications.
secret
- Symfony variable - generate it by going here or running in shell openssl rand -hex 20
N.B.
After doing any changes on app/config/parameters.yml run php bin/console cache:clear --env=prod
for them to take effect.
Once the App is up-and-running you have to create at least one tournament, so that users are able to join it when they register and login.
Create tournament by navigating to: Admin Panel -> Tournaments. After the tournament is created, you have to options:
Automatic updating of teams, match fixtures/results data (via API)
Manual updating of teams, match fixtures/results data
Create/edit tournaments (Admin panel -> Tournaments)
Create/edit tournament-to-API mappings (Admin panel -> API Mappings) - this is required for any tournament for which you want to fetch teams, matches data via API.
Update teams data:
Update match fixtures:
Update match results:
Standings/scores updates (Admin Panel -> Scores/Standings Update) - required only when manually updating match results.
Updating of match fixtures and results via API fetch can be scheduled by using Cron the following commands:
php bin/console --env=prod sportify:data:update matches-fixtures <days>
- get match fixtures for the next number of days
php bin/console --env=prod sportify:data:update matches-results <days>
- get match results for the previous number of days
Send notifications to users which have not made a prediction for upcoming matches (in the next 2 hours) in tournaments they have joined:
php bin/console --env=prod sportify:notify users-not-predicted
Example crontab entries (assuming your project folder is: /var/www/sportify):
5,35 * * * * php /var/www/sportify/bin/console --env=prod sportify:notify users-not-predicted >> /var/www/sportify/var/log_notify.txt
0 8 * * 1 php /var/www/sportify/bin/console --env=prod sportify:data:update matches-fixtures 14 >> /var/www/sportify/var/log_data_updates.txt
0 1 * * * php /var/www/sportify/bin/console --env=prod sportify:data:update matches-results 1 >> /var/www/sportify/var/log_data_updates.txt
We accept all kind of contributions that you guys make and we'll love you for them! <3
If you find any problems, have any suggestions or want to discuss something you can either open an issue here or make a pull request with code changes instead.
If you want to contribute, but you're not sure where to start you can always take a look at the open issues we have and pick any of them.
Try to follow our conventions for naming issues, branches and existing code structure and conventions.