{"id":13828436,"url":"https://github.com/xoco70/laravel-tournaments","last_synced_at":"2025-12-13T07:42:36.005Z","repository":{"id":49096357,"uuid":"81481801","full_name":"xoco70/laravel-tournaments","owner":"xoco70","description":"Laravel Package that allows you to generate customizable tournaments trees. - This project repo is no longer being maintained","archived":false,"fork":false,"pushed_at":"2023-09-19T09:18:08.000Z","size":3446,"stargazers_count":230,"open_issues_count":11,"forks_count":50,"subscribers_count":17,"default_branch":"master","last_synced_at":"2024-11-08T00:38:47.002Z","etag":null,"topics":["generator","kendo","laravel","laravel-5-package","php","sports","tournament","tree-structure"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xoco70.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":"code-of-conduct.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-02-09T18:32:49.000Z","updated_at":"2024-11-03T05:14:14.000Z","dependencies_parsed_at":"2024-06-19T15:58:49.665Z","dependency_job_id":null,"html_url":"https://github.com/xoco70/laravel-tournaments","commit_stats":{"total_commits":532,"total_committers":9,"mean_commits":"59.111111111111114","dds":0.4342105263157895,"last_synced_commit":"6b14973db158882487c13aedd78bcb996b572973"},"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xoco70%2Flaravel-tournaments","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xoco70%2Flaravel-tournaments/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xoco70%2Flaravel-tournaments/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xoco70%2Flaravel-tournaments/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xoco70","download_url":"https://codeload.github.com/xoco70/laravel-tournaments/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225476318,"owners_count":17480220,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["generator","kendo","laravel","laravel-5-package","php","sports","tournament","tree-structure"],"created_at":"2024-08-04T09:02:46.749Z","updated_at":"2025-12-13T07:42:30.983Z","avatar_url":"https://github.com/xoco70.png","language":"PHP","funding_links":[],"categories":["PHP"],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\n\u003cbr\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/xoco70/laravel-tournaments/master/resources/assets/images/logo.png\" alt=\"Laravel Tournaments\"\u003e\n\u003cbr\u003e\nLaravel Tournaments\n\u003cbr\u003e\n\u003c/h1\u003e\n\n\u003ch4 align=\"center\"\u003eA Laravel plugin that generate tournaments out of the box\u003c/h4\u003e\n\n\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://packagist.org/packages/xoco70/laravel-tournaments\"\u003e\u003cimg src=\"https://poser.pugx.org/xoco70/laravel-tournaments/v/stable\" alt=\"Latest Stable Version\"\u003e\u003c/a\u003e\n\u003ca href=\"https://packagist.org/packages/xoco70/laravel-tournaments\"\u003e\u003cimg src=\"https://poser.pugx.org/xoco70/laravel-tournaments/downloads\" alt=\"Total Downloads\"\u003e\u003c/a\u003e\n\u003ca href=\"https://scrutinizer-ci.com/g/xoco70/laravel-tournaments/?branch=master\"\u003e\u003cimg src=\"https://scrutinizer-ci.com/g/xoco70/laravel-tournaments/badges/quality-score.png?b=master\" alt=\"Scrutinizer Code Quality\" data-canonical-src=\"https://scrutinizer-ci.com/g/xoco70/laravel-tournaments/badges/quality-score.png?b=master\" style=\"max-width:100%;\"\u003e\u003c/a\u003e\n\u003ca href=\"https://travis-ci.org/xoco70/laravel-tournaments\"\u003e\u003cimg src=\"https://travis-ci.org/xoco70/laravel-tournaments.svg?branch=master\" alt=\"Build Status\" data-canonical-src=\"https://travis-ci.org/xoco70/laravel-tournaments.svg?branch=master\" style=\"max-width:100%;\"\u003e\u003c/a\u003e\n\u003ca href=\"https://scrutinizer-ci.com/g/xoco70/laravel-tournaments/?branch=master\"\u003e\u003cimg src=\"https://scrutinizer-ci.com/g/xoco70/laravel-tournaments/badges/coverage.png?b=master\" alt=\"Code Coverage\" data-canonical-src=\"https://scrutinizer-ci.com/g/xoco70/laravel-tournaments/badges/coverage.png?b=master\" style=\"max-width:100%;\"\u003e\u003c/a\u003e\n\n\u003c/p\u003e\n\u003ch1 align=\"center\"\u003e\n\u003cbr\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/xoco70/laravel-tournaments/master/resources/assets/images/laravel-tournaments.gif\" alt=\"Laravel Tournaments Demo\"\u003e\n\u003c/h1\u003e\n\n* [Features](#features)\n* [Installation](#installation)\n* [Demo](#demo)\n* [Usage](#usage)\n* [Data Model](#data-model)\n* [Models](#models)\n* [Include views](#include-views)   \n* [Limitations](#limitations)\n* [Troubleshooting](#troubleshooting)\n* [Changelog](#changelog)\n\n## Features\n\n- Single Elimination Trees Generation\n- Single Elimination with Preliminary Round Generation\n- Playoff Generation\n- Third place fight\n- List of Fights Generation\n- Customize Preliminary Round Size\n- Customize area number (1,2,4,8)\n- Modify Single Elimination Tree generation on the fly\n- Use teams instead of competitors\n\n## Installation\n\u003e **NOTE**: Depending on your version of Laravel, you should install a different\n\u003e version of the package:\n\u003e \n\u003e | Laravel Version | Laravel Tournament Version |\n\u003e |:---------------:|:--------------------------:|\n\u003e |        8        |            0.17            |\n\u003e |    5.8 -\u003e 7     |            0.16            |\n\u003e |       5.7       |            0.15            |\n\u003e |       5.6       |            0.14            |\n\u003e |       5.5       |            0.13            |\n\nFirst, you'll need to install the package via Composer:\n\n```php\ncomposer require \"xoco70/laravel-tournaments\"\n```\n\nFinally, from the command line again, publish the default configuration file:\n\n```php\nphp artisan vendor:publish --tag=laravel-tournaments --force\n```\n\n## Demo\n\nTo run the demo, you need to generate Tournaments, Championships, Users, Competitors and Settings\n\nRun Migrations:\n```php\nphp artisan migrate\ncomposer dump-autoload\n```\n\nSeed dummy data:\n```php\nphp artisan db:seed --class=LaravelTournamentSeeder\n\n```\n\u003e **WARNING**: Don't do this in production, it would wipe all your data. Use this line for demo purpose only\n\nAdd TreeController ( you can find it in [demo repository](https://github.com/xoco70/laravel-tournaments-demo/blob/master/app/Http/Controllers/TreeController.php))\n\nAdd your custom routes\n\n```php\nRoute::get('/', 'App\\Http\\Controllers\\TreeController@index')-\u003ename('tree.index');\nRoute::post('/championships/{championship}/trees', 'App\\Http\\Controllers\\TreeController@store')-\u003ename('tree.store');\nRoute::put('/championships/{championship}/trees', 'App\\Http\\Controllers\\TreeController@update')-\u003ename('tree.update');\n```\n\n```php\nphp artisan db:seed --class=LaravelTournamentSeeder\n\n```\n\nYou will be able to access the demo at `http://yourdomain.com/`\n\n## Usage\n```php\n// Create a tournament\n\n$tournament = factory(Tournament::class)-\u003ecreate(['user_id' =\u003e Auth::user()-\u003eid]);\n\n$championsip = factory(Championship::class)-\u003ecreate(['$tournament_id' =\u003e $tournament-\u003eid]);\n\n// Optional, if not defined, it will take default in ChampionshipSettings\n\n$settings = factory(ChampionshipSettings::class)-\u003ecreate(['championship_id' =\u003e $championship-\u003eid]);\n\n// Add competitors to championship\n\n$competitors = factory(\\App\\Competitor::class,10)-\u003ecreate([\n    'championship_id' =\u003e $championship-\u003eid,\n     'user_id' =\u003e factory(User::class)-\u003ecreate()-\u003eid\n]);\n\n// Define strategy to generate\n\n$generation = $championship-\u003echooseGenerationStrategy();\n\n// Generate everything\n\n$generation-\u003erun();\n\n// Just generate Tree\n\n$this-\u003egenerateAllTrees();\n\n// Just generate Fight List\n\n$this-\u003egenerateAllFights();\n\n```\n## Data model\n![Database Model](https://raw.githubusercontent.com/xoco70/laravel-tournaments/master/resources/assets/images/laravel-tournaments-database-model.png)\n\n## Models\n### Tournament\n\n```php\n$tournament-\u003eowner; // get owner\n$tournament-\u003evenue; // get venue\n$tournament-\u003echampionships; // get championships \n```\n\nCheck tournament type: \n```php\n$tournament-\u003eisOpen()\n$tournament-\u003eneedsInvitation()\n```\n\nCheck tournament level:\n```php\n$tournament -\u003eisInternational()\n$tournament-\u003eisNational() \n$tournament-\u003eisRegional()\n$tournament-\u003eisEstate()\n$tournament-\u003eisMunicipal()\n$tournament-\u003eisDistrictal()\n$tournament-\u003eisLocal()\n$tournament-\u003ehasNoLevel()\n```\n## Championship\n\n```php\n$championship-\u003ecompetitors; // Get competitors\n$championship-\u003eteams; // Get teams\n$championship-\u003efighters; // Get fighters\n$championship-\u003ecategory; // Get category\n$championship-\u003etournament; // Get tournament\n$championship-\u003eusers; // Get users\n$championship-\u003esettings; // Get settings\n$championship-\u003efightersGroups; // Get groups \n$championship-\u003egroupsByRound($numRound = 1); // Get groups for a specific round\n$championship-\u003egroupsFromRound($numRound = 1); // Get groups from a specific round\n$championship-\u003efights; // Get fights\n$championship-\u003efirstRoundFights; // Get fights for the first round only ( Useful when has preliminary )\n$championship-\u003efights($numRound = 1); // Get fights for a specific round\n```\n\u003e **NOTE**: $fighter can be an instance of `Team` or `Competitor`\n\n\nDetermine strategy:\n```php\n$championship-\u003eisPlayoffCompetitor()\n$championship-\u003eisPlayoffTeam()\n$championship-\u003eisSingleEliminationCompetitor()\n$championship-\u003eisSingleEliminationTeam()\n```\n\nDetermine group size:\n```php\n$championship-\u003egetGroupSize()\n```\n\nDetermine championship type: \n```php\n$championship-\u003ehasPreliminary()\n$championship-\u003eisPlayOffType()\n$championship-\u003eisSingleEliminationType()\n```\n\n\n### FightersGroup\n\n```php\n$group-\u003echampionship; // Get championship\n$group-\u003efights; // Get fights\n$group-\u003efighters; // Get fighters\n$group-\u003eteams; // Get teams\n$group-\u003ecompetitors; // Get competitors\n$group-\u003eusers; // Get users\n```\n\u003e **NOTE**: $fighter can be an instance of `Team` or `Competitor`\n\nTo get the instance name:\n```php\n$group-\u003egetFighterType() // Should return Team::class or Competitor::class\n```\n\n\u003e **NOTE**: This plugin use \u003ca href=\"https://github.com/lazychaser/laravel-nestedset\"\u003elaravel-nestedset\u003c/a\u003e. \nThis means you can navigate with `$group-\u003echildren()` or `$group-\u003eparent()` or use any methods available in this great plugin.  \n\n### Competitor\n\n```php\n$competitor-\u003euser; // Get user\n```\n\n### Team\n```php\n// Create a team\n\n$team = factory(Team::class)\n    -\u003ecreate([ championship_id' =\u003e $championship-\u003eid]);\n```\n\n```php\n// Add competitor to team \n\n$team-\u003ecompetitors()-\u003eattach($competitor-\u003eid);\n\n// Remove competitor from a team \n\n$team-\u003ecompetitors()-\u003edetach($competitor-\u003eid);\n\n```\n\n### Fight \n\n```php\n$fight-\u003egroup; // Get group\n$fight-\u003ecompetitor1; // Get competitor1\n$fight-\u003ecompetitor2; // Get competitor2\n$fight-\u003eteam1; // Get team1\n$fight-\u003eteam2; // Get team2\n```\n\n## Views\nPreliminary tree\n```php\n@include('laravel-tournaments::partials.tree.preliminary') // Preliminary table\n```\n\nSingle Elimination tree\n```php\n@include('laravel-tournaments::partials.tree.singleElimination', ['hasPreliminary' =\u003e 0]) \n```\n\nFight List\n```php\n@include('laravel-tournaments::partials.fights')\n```\n\n## Run Functional Tests\n\nvendor/bin/phpunit tests\n\n## Limitations\n\nThis is a work in progress, and tree creation might be very complex, so there is a bunch of things to achieve.  \n\n- Seed fighter\n- Manage more than 1 fighter out of preliminary round\n- Modify Preliminary Round generation on the fly\n- Use any number of area ( restricted to 1,2,4,8)\n- Manage n+1 case : When for instance, there is 17 competitors in a direct elimination tree, there will have 15 BYES.\nWe can improve that making the first match with 3 competitors.\n- Double elimination\n \n## Troubleshooting\n\n### Specified key was too long error\nFor those running MariaDB or older versions of MySQL you may hit this error when trying to run migrations:\nAs outlined in the \u003ca href=\"https://laravel.com/docs/master/migrations#creating-indexes\"\u003eMigrations guide\u003c/a\u003e to fix this all you have to do is edit your AppServiceProvider.php file and inside the boot method set a default string length:\n```php\nuse Illuminate\\Support\\Facades\\Schema;\n\npublic function boot()\n{\nSchema::defaultStringLength(191);\n}\n```\n### With this configuration, you must have at least...\nThis error means you don't have enough competitors / teams to create given tree\nTry to increase competitor number, decrease areas or preliminary group size, if preliminary round is active \n\n## ChangeLog:\n\n- v0.17: Update to Laravel 8\n- v0.16: Update to Laravel 5.8\n- v0.15: Update to Laravel 5.7\n- v0.14: Update to Laravel 5.6 / PHP 7.2 support\n- v0.13: Manage third place fight\n- v0.12: Update to Laravel 5.5\n- v0.11: Initial Version\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxoco70%2Flaravel-tournaments","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxoco70%2Flaravel-tournaments","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxoco70%2Flaravel-tournaments/lists"}