esi / librariesio
LibrariesIO - A simple API wrapper/client for the Libraries.io API.
Fund package maintenance!
ko-fi.com/ericsizemore
ericsizemore
Tidelift
Requires
- php: ^8.2 <8.5
- guzzlehttp/guzzle: ^7.0 <8.0
- kevinrob/guzzle-cache-middleware: ^5.1 <6.0
- symfony/cache: ^7.0
Requires (Dev)
- friendsofphp/php-cs-fixer: dev-master
- phpstan/phpstan: ^1.11 <2.0
- phpstan/phpstan-phpunit: ^1.4
- phpstan/phpstan-strict-rules: ^1.6
- phpunit/phpunit: ^11
This package is auto-updated.
Last update: 2024-12-23 02:37:56 UTC
README
2.0.0 Important Note
- The
master
branch is for development of the upcoming version 2.0.0.- This is a notable exception to the backward compatibility promise, as most of this work was done before it was implemented.
- Should be relatively stable, but would still advise against using in production.
- Function parameters, class api's, etc. may change during development.
- The docs have not yet been fully updated with changes.
Important Note
This project was born from the desire to expand my knowledge of API's and GuzzleHttp. My implementation is far from perfect, so I am open to any and all feedback that one may wish to provide.
- The Libraries.io API has the ability for pagination, however it is not yet fully implemented in this library.
Installation
Composer
Install the latest version with:
$ composer require esi/librariesio
Then, within your project (if not already included), include composer's autoload. For example:
<?php require 'vendor/autoload.php'; ?>
For more information see the installation docs.
Basic Usage
LibrariesIO splits the different endpoints based on their "component":
- Esi\LibrariesIO\LibrariesIO::platform()
- does not require an $endpoint, though you can pass 'platforms'.
- Esi\LibrariesIO\LibrariesIO::project()
- takes an 'endpoint' parameter to specify which subset you are looking for.
- Current endpoints are:
- contributors
- dependencies
- dependents
- dependent_repositories
- project
- search
- sourceRank
- Current endpoints are:
- takes an 'endpoint' parameter to specify which subset you are looking for.
- Esi\LibrariesIO\LibrariesIO::repository()
- takes an 'endpoint' parameter to specify which subset you are looking for.
- Current endpoints are:
- dependencies
- projects
- repository
- Current endpoints are:
- takes an 'endpoint' parameter to specify which subset you are looking for.
- Esi\LibrariesIO\LibrariesIO::user()
- takes an 'endpoint' parameter to specify which subset you are looking for.
- Current endpoints are:
- dependencies
- packages
- package_contributions
- repositories
- repository_contributions
- subscriptions
- user
- Current endpoints are:
- takes an 'endpoint' parameter to specify which subset you are looking for.
- Esi\LibrariesIO\LibrariesIO::subscription()
- takes an 'endpoint' parameter to specify which subset you are looking for.
- Current endpoints are:
- subscribe
- check
- update
- unsubscribe
- Current endpoints are:
- takes an 'endpoint' parameter to specify which subset you are looking for.
Each 'subset' has their own required options. Check the documentation (currently WIP) for more information.
As an example, let's say you want to get a list of the available platforms. To do so:
<?php use Esi\LibrariesIO\LibrariesIO; use Esi\LibrariesIO\Utils; $api = new LibrariesIO('..yourapikey..', \sys_get_temp_dir()); $response = $api->platform(); print_r(Utils::toArray($response)); /* Array ( [0] => Array ( [name] => NPM [project_count] => 4079049 [homepage] => https://www.npmjs.com [color] => #f1e05a [default_language] => JavaScript ) [1] => Array ( [name] => Maven [project_count] => 588275 [homepage] => http://maven.org [color] => #b07219 [default_language] => Java ) [...] ) */ ?>
For more information see the basic usage docs.
Documentation
The docs/
folder or online here.
About
Requirements
- LibrariesIO works with PHP 8.2.0 or above.
- All API requests include an api_key parameter. You will need to get your api key from your account page at libraries.io.
Credits
- Eric Sizemore
- All Contributors
- Special thanks to JetBrains for their Licenses for Open Source Development
Contributing
See CONTRIBUTING.
Bugs and feature requests are tracked on GitHub.
Contributor Covenant Code of Conduct
Backward Compatibility Promise
See backward-compatibility.md for more information on Backwards Compatibility.
Changelog
See the CHANGELOG for more information on what has changed recently.
License
See the LICENSE for more information on the license that applies to this project.
Security
See SECURITY for more information on the security disclosure process.