{"id":31789300,"url":"https://github.com/aternosorg/php-spigot-api","last_synced_at":"2026-07-22T17:06:16.813Z","repository":{"id":318339702,"uuid":"1070905116","full_name":"aternosorg/php-spigot-api","owner":"aternosorg","description":"An API client for the SpigotMC API written in PHP.","archived":false,"fork":false,"pushed_at":"2026-03-17T11:41:14.000Z","size":137,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-01T04:26:07.108Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://packagist.org/packages/aternos/spigot-api","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aternosorg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-10-06T15:38:03.000Z","updated_at":"2026-03-17T11:39:18.000Z","dependencies_parsed_at":"2025-10-06T17:02:38.478Z","dependency_job_id":"fa715b83-c564-43e4-842a-0396669654bf","html_url":"https://github.com/aternosorg/php-spigot-api","commit_stats":null,"previous_names":["aternosorg/php-spigot-api"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/aternosorg/php-spigot-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aternosorg%2Fphp-spigot-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aternosorg%2Fphp-spigot-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aternosorg%2Fphp-spigot-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aternosorg%2Fphp-spigot-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aternosorg","download_url":"https://codeload.github.com/aternosorg/php-spigot-api/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aternosorg%2Fphp-spigot-api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35770024,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-07-20T02:08:10.276Z","status":"online","status_checked_at":"2026-07-22T02:00:06.236Z","response_time":124,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2025-10-10T14:50:40.544Z","updated_at":"2026-07-22T17:06:16.801Z","avatar_url":"https://github.com/aternosorg.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Aternos/php-spigot-api\nAn API client for the SpigotMC API written in PHP. This client is a combination of\ncode generated by OpenAPI Generator and thin wrappers to improve usability.\nIt builds upon the [XenforoResourceManagerAPI](https://github.com/SpigotMC/XenforoResourceManagerAPI/) and uses its [OpenAPI specification](https://github.com/SpigotMC/XenforoResourceManagerAPI/blob/master/src/openapi.yaml).\n\nThe generated code can be found in `src/Api` and `src/Model`.\nIt is recommended to use the wrappers in `src/Client` instead of the generated code.\n\n## Requirements\n- PHP 8.3 or newer  \n- PHP extensions: curl, json, mbstring  \n\n## Installation\nInstall the package via composer:\n```bash\ncomposer require aternos/spigot-api\n```\n\n## Usage\n\nThe main entry point for the API is the `SpigotAPIClient` class.\n```php\n\u003c?php\nuse Aternos\\SpigotApi\\Client\\SpigotAPIClient;\n\n// create an API client (main entry point)\n$spigotClient = new SpigotAPIClient();\n\n// set a user agent (recommended)\n$spigotClient-\u003esetUserAgent('aternos/php-spigot-api-example');\n```\n\n## Result Lists\nMost methods return a paginated result list containing the current page of results and navigation helpers.\nThe result list implements `Iterator`, `ArrayAccess` and `Countable` so it can be used like an array. \nIt also has a `getResults()` method returning the underlying array.\n\n### listProjects()\n[XenforoResourceManagerAPI#listResources](https://github.com/SpigotMC/XenforoResourceManagerAPI?tab=readme-ov-file#listresources)\n\nTo list all projects (resources) on SpigotMC (paginated) for a given page, use `listProjects()`.\n\n**Parameters**\n- `int $page = 1`. Optional. Default: 1. The page number to retrieve. Items are paginated at 10 results per page.\n\n```php\n$projects = $spigotClient-\u003elistProjects(1);\n\nforeach ($projects as $project) {\n    // wrappers expose underlying model via getData()\n    echo $project-\u003egetData()-\u003egetTitle() . PHP_EOL;\n}\n\n$projects = $projects-\u003egetNextPage();\n\nforeach ($projects as $project) {\n    echo $project-\u003egetData()-\u003egetTitle() . PHP_EOL;\n}\n```\n\n### listProjectsForCategory()\n[XenforoResourceManagerAPI#listResources](https://github.com/SpigotMC/XenforoResourceManagerAPI?tab=readme-ov-file#listresources)\n\nTo list all projects (resources) on SpigotMC (paginated) for a given category and page, use `listProjectsForCategory()`.\n\n**Parameters**\n- `Category $category`. Required. The category to filter by. From `Aternos\\SpigotApi\\Client\\Category` enum.\n- `int $page = 1`. Optional. Default: 1. The page number to retrieve. Items are paginated at 10 results per page.\n\n```php\n$projects = $spigotClient-\u003elistProjectsForCategory(Category::SPIGOT, 1);\n\nforeach ($projects as $project) {\n    // wrappers expose underlying model via getData()\n    echo $project-\u003egetData()-\u003egetTitle() . PHP_EOL;\n}\n\n$projects = $projects-\u003egetNextPage();\n\nforeach ($projects as $project) {\n    echo $project-\u003egetData()-\u003egetTitle() . PHP_EOL;\n}\n```\n## Projects / Resources\n\n### getProject()\n[XenforoResourceManagerAPI#getResource](https://github.com/SpigotMC/XenforoResourceManagerAPI?tab=readme-ov-file#getresource)\n\nTo get a single project (resource) by its numeric id, use `getProject()`.\n\n**Parameters**\n- `int $id`. Required. The numeric id of the project.\n\n```php\n// get a specific project (by numeric id)\n$project = $spigotClient-\u003egetProject(2);\n\n// get data from the wrapper\n$id = $project-\u003egetData()-\u003egetId();\n$title = $project-\u003egetData()-\u003egetTitle();\n$description = $project-\u003egetData()-\u003egetDescription();\n```\n\n### More information\nTo request more information about a project from the API, use the methods on the `Project` wrapper.\n\n```php\n// get a specific project (by numeric id)\n$project = $spigotClient-\u003egetProject(2);\n\n// get versions as a PaginatedVersionList\n$versions = $project-\u003egetVersions();\n\n// get the author\n$author = $project-\u003egetAuthor();\n```\n\n## Authors\n\n### getAuthor()\n[XenforoResourceManagerAPI#getAuthor](https://github.com/SpigotMC/XenforoResourceManagerAPI?tab=readme-ov-file#getauthor)\n\nTo get a single author by its numeric id, use `getAuthor()`.\n\n**Parameters**\n- `int $id`. Required. The numeric id of the author.\n\n```php\n$author = $spigotClient-\u003egetAuthor(1);\n\n// get data from the wrapper\n$id = $author-\u003egetData()-\u003egetId();\n$username = $author-\u003egetData()-\u003egetUsername();\n$resources = $author-\u003egetData()-\u003egetResourceCount();\n$identities = $author-\u003egetData()-\u003egetIdentities();\n$avatarUrl = $author-\u003egetData()-\u003egetAvatar();\n$activity = $author-\u003egetData()-\u003egetLastActivity();\n```\n\n### findAuthor()\n[XenforoResourceManagerAPI#findAuthor](https://github.com/SpigotMC/XenforoResourceManagerAPI?tab=readme-ov-file#findauthor)\n\nTo find an author by username, use `findAuthor()`.\n\n**Parameters**\n- `string $name`. Required. The username of the author.\n\n```php\n$author = $spigotClient-\u003efindAuthor(\"md_5\");\n\n// get data from the wrapper\n$id = $author-\u003egetData()-\u003egetId();\n$username = $author-\u003egetData()-\u003egetUsername();\n$resources = $author-\u003egetData()-\u003egetResourceCount();\n$identities = $author-\u003egetData()-\u003egetIdentities();\n$avatarUrl = $author-\u003egetData()-\u003egetAvatar();\n$activity = $author-\u003egetData()-\u003egetLastActivity();\n```\n\n### More information\nTo request more information about an author from the API, use the methods on the `Author` wrapper.\n\n```php\n// get a specific author (by numeric id)\n$author = $spigotClient-\u003egetAuthor(1);\n\n// get projects as a PaginatedProjectList\n$projects = $author-\u003egetProjects();\n```\n\n### getAuthorProjects()\n[XenforoResourceManagerAPI#getResourcesByAuthor](https://github.com/SpigotMC/XenforoResourceManagerAPI?tab=readme-ov-file#getresourcesbyauthor)\n\nTo list all projects for an author (paginated), use `getAuthorProjects()`.\n\n**Parameters**\n- `int $id`. Required. The numeric id of the author.\n- `int $page = 1`. Optional. Default: 1. The page number to retrieve. Items are paginated at 10 results per page.\n\n```php\n// list all projects from Luck\n$projects = $spigotClient-\u003egetAuthorProjects(100356);\nforeach ($projects as $project) {\n    echo $project-\u003egetData()-\u003egetTitle() . PHP_EOL;\n}\n```\n\n## Resource Updates / Project Versions\n\n### getProjectVersions()\n[XenforoResourceManagerAPI#getResourceUpdates](https://github.com/SpigotMC/XenforoResourceManagerAPI?tab=readme-ov-file#getresourceupdates)\n\nTo fetch paginated updates for a project, use `getProjectVersions()`.\n\n**Parameters**\n- `int $id`. Required. The numeric id of the project.\n- `int $page = 1`. Optional. Default: 1. The page number to retrieve. Items are paginated at 10 results per page.\n\n```php\n$versions = $spigotClient-\u003egetProjectVersions(2);\nforeach ($versions as $version) {\n    echo $version-\u003egetData()-\u003egetTitle() . PHP_EOL;\n}\n```\n\n### getVersion()\n[XenforoResourceManagerAPI#getResourceUpdate](https://github.com/SpigotMC/XenforoResourceManagerAPI?tab=readme-ov-file#getresourceupdate)\n\nTo fetch a specific update by its id, use `getVersion()`.\n\n**Parameters**\n- `int $id`. Required. The numeric id of the version.\n\n```php\n$version = $spigotClient-\u003egetVersion(352711);\necho $version-\u003egetData()-\u003egetTitle() . PHP_EOL;\necho $version-\u003egetData()-\u003egetMessage() . PHP_EOL;\n```\n\n### More information\nTo request more information about a version from the API, use the methods on the `Version` wrapper.\n\n```php\n// get a specific version (by numeric id)\n$version = $spigotClient-\u003egetVersion(352711);\n\n// get the ID of the project this version belongs to\n$projectId = $version-\u003egetProjectId();\n\n// get the project as a Project wrapper\n$project = $version-\u003egetProject();\n```\n\n## Updating the generated code\nUpdate the generated code by installing the [openapi generator](https://openapi-generator.tech/docs/installation) and running:\n```bash\nopenapi-generator-cli generate -c config.yaml\n```\n\n## Tests\nThis project provides two kinds of automated tests:\n\n### Unit tests\nUnit tests use fixtures (recorded JSON responses) instead of performing real HTTP requests.\nRun only unit tests:\n```bash\nvendor/bin/phpunit --testsuite=unit --testdox\n```\n\n### Integration tests\nIntegration tests perform real requests against the live SpigotMC API.\nRun only integration tests:\n```bash\nvendor/bin/phpunit --testsuite=integration --testdox\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faternosorg%2Fphp-spigot-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faternosorg%2Fphp-spigot-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faternosorg%2Fphp-spigot-api/lists"}