Download the PHP package aternos/spigot-api without Composer
On this page you can find all versions of the php package aternos/spigot-api. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package spigot-api
Aternos/php-spigot-api
An API client for the SpigotMC API written in PHP. This client is a combination of code generated by OpenAPI Generator and thin wrappers to improve usability. It builds upon the XenforoResourceManagerAPI and uses its OpenAPI specification.
The generated code can be found in src/Api and src/Model.
It is recommended to use the wrappers in src/Client instead of the generated code.
Requirements
- PHP 8.3 or newer
- PHP extensions: curl, json, mbstring
Installation
Install the package via composer:
Usage
The main entry point for the API is the SpigotAPIClient class.
Result Lists
Most methods return a paginated result list containing the current page of results and navigation helpers.
The result list implements Iterator, ArrayAccess and Countable so it can be used like an array.
It also has a getResults() method returning the underlying array.
listProjects()
XenforoResourceManagerAPI#listResources
To list all projects (resources) on SpigotMC (paginated) for a given page, use listProjects().
Parameters
int $page = 1. Optional. Default: 1. The page number to retrieve. Items are paginated at 10 results per page.
listProjectsForCategory()
XenforoResourceManagerAPI#listResources
To list all projects (resources) on SpigotMC (paginated) for a given category and page, use listProjectsForCategory().
Parameters
Category $category. Required. The category to filter by. FromAternos\SpigotApi\Client\Categoryenum.int $page = 1. Optional. Default: 1. The page number to retrieve. Items are paginated at 10 results per page.
Projects / Resources
getProject()
XenforoResourceManagerAPI#getResource
To get a single project (resource) by its numeric id, use getProject().
Parameters
int $id. Required. The numeric id of the project.
More information
To request more information about a project from the API, use the methods on the Project wrapper.
Authors
getAuthor()
XenforoResourceManagerAPI#getAuthor
To get a single author by its numeric id, use getAuthor().
Parameters
int $id. Required. The numeric id of the author.
findAuthor()
XenforoResourceManagerAPI#findAuthor
To find an author by username, use findAuthor().
Parameters
string $name. Required. The username of the author.
More information
To request more information about an author from the API, use the methods on the Author wrapper.
getAuthorProjects()
XenforoResourceManagerAPI#getResourcesByAuthor
To list all projects for an author (paginated), use getAuthorProjects().
Parameters
int $id. Required. The numeric id of the author.int $page = 1. Optional. Default: 1. The page number to retrieve. Items are paginated at 10 results per page.
Resource Updates / Project Versions
getProjectVersions()
XenforoResourceManagerAPI#getResourceUpdates
To fetch paginated updates for a project, use getProjectVersions().
Parameters
int $id. Required. The numeric id of the project.int $page = 1. Optional. Default: 1. The page number to retrieve. Items are paginated at 10 results per page.
getVersion()
XenforoResourceManagerAPI#getResourceUpdate
To fetch a specific update by its id, use getVersion().
Parameters
int $id. Required. The numeric id of the version.
More information
To request more information about a version from the API, use the methods on the Version wrapper.
Updating the generated code
Update the generated code by installing the openapi generator and running:
Tests
This project provides two kinds of automated tests:
Unit tests
Unit tests use fixtures (recorded JSON responses) instead of performing real HTTP requests. Run only unit tests:
Integration tests
Integration tests perform real requests against the live SpigotMC API. Run only integration tests:
All versions of spigot-api with dependencies
ext-curl Version *
ext-json Version *
ext-mbstring Version *
guzzlehttp/guzzle Version ^7.3
guzzlehttp/psr7 Version ^1.7 || ^2.0