ghostwriter / libraries-io
A libraries.io API Client for PHP
Fund package maintenance!
0.1.0
2026-05-27 03:03 UTC
Requires
- php: ~8.4.0 || ~8.5.0
- ext-mbstring: *
- ghostwriter/clock: ^3.0.1
- ghostwriter/container: ^7.0.2
- ghostwriter/event-dispatcher: ^6.1.1
- ghostwriter/http: ^0.2.0
- ghostwriter/uuid: ^1.0.3
Requires (Dev)
- ext-xdebug: *
- boundwize/structarmed: ^0.7.12
- ghostwriter/coding-standard: dev-main
- ghostwriter/testify: ^0.1.1
- mockery/mockery: ^1.6.12
- phpunit/phpunit: ^13.1.12
- symfony/var-dumper: ^8.0.8
- 1.0.x-dev
- 0.2.x-dev
- 0.1.x-dev
- 0.1.0
- dev-main
- dev-merge-up/1.0.x-into-main
- dev-merge-up/0.2.x-into-1.0.x
- dev-merge-up/0.1.x-into-0.2.x
- dev-composer-boundwize-structarmed-0.8.0
- dev-phpunit-configuration
- dev-infection-configuration
- dev-composer-ghostwriter-coding-standard-dev-main
- dev-composer-guzzlehttp-psr7-2.10.3
- dev-composer-guzzlehttp-guzzle-7.10.5
- dev-composer-symfony-string-8.0.13
- dev-composer-symfony-console-8.0.13
- dev-composer-install-ghostwriter-phpunit-assertions
- dev-composer-ghostwriter-testify-0.1.2
- dev-composer-ghostwriter-clock-3.0.2
- dev-github-settings
This package is auto-updated.
Last update: 2026-05-28 07:34:02 UTC
README
A libraries.io API Client for PHP.
Installation
You can install the package via composer:
composer require ghostwriter/libraries-io
Star ⭐️ this repo if you find it useful
You can also star (🌟) this repo to find it easier later.
Usage
<?php declare(strict_types=1); use Ghostwriter\LibrariesIo\LibrariesIoClient; // This will attempt to resolve the API token from the `LIBRARIES_IO_TOKEN` environment variable $client = LibrariesIoClient::new(); // or manually provide the API token from https://libraries.io/account $client = LibrariesIoClient::new('Valid40CharactersLongNonEmptyTokenString'); $response = $client->get('search', [ 'platforms' => 'Packagist', 'q' => 'ghostwriter/container', 'per_page' => 30, // default is 30, max is 100 'page' => 1, // default is 1 ]); $payload = $response->getBody()->getContents(); echo $payload;
API Methods
The client supports these API methods:
// Platforms: Get a list of supported package managers. $client->get('platforms'); // Project: Get information about a package and its versions. $client->get('Packagist/ghostwriter/container'); // Project Dependencies: Get a list of dependencies for a version of a project, pass latest to get dependency info for the latest available version $client->get('Packagist/ghostwriter/container/dependencies'); // Project Dependents: Get packages that have at least one version that depends on a given project. $client->get('Packagist/ghostwriter/container/dependents'); // Project Dependent Repositories: Get repositories that depend on a given project. $client->get('Packagist/ghostwriter/container/dependent_repositories'); // Project Contributors: Get users that have contributed to a given project. $client->get('Packagist/ghostwriter/container/contributors'); // Project SourceRank: Get breakdown of SourceRank score for a given project. $client->get('Packagist/ghostwriter/container/sourcerank'); // Project Search: Search for projects by name $client->get('search', [ 'q' => 'ghostwriter/container', 'keywords' => 'container', 'platforms' => 'Packagist', 'languages' => 'PHP', 'licenses' => 'BSD-3-Clause', ]); // Repository: Get info for a repository. (only works for open source repositories) $client->get('github/ghostwriter/container'); // Repository Dependencies: Get a list of dependencies for all of a repository's projects. (only works for open source repositories) $client->get('github/ghostwriter/container/dependencies'); // Repository Projects: Get a list of packages referencing the given repository. $client->get('github/ghostwriter/container/projects'); // User: Get information for a given user or organization. $client->get('github/ghostwriter'); // User Repositories: Get repositories owned by a user. $client->get('github/ghostwriter/repositories'); // User Packages: Get a list of packages referencing the given user's repositories. $client->get('github/ghostwriter/projects'); // User Packages Contributions: Get a list of packages that the given user has contributed to. $client->get('github/ghostwriter/project-contributions'); // User Repository Contributions: Get a list of repositories that the given user has contributed to. $client->get('repositories/github/ghostwriter/repository-contributions'); // User Dependencies: Get a list of unique packages that the given user's repositories list as a dependency. Ordered by frequency of use in those repositories. $client->get('dependencies/github/ghostwriter/dependencies'); // User Subscriptions: List packages that a user is subscribed to receive notifications about new releases. $client->get('subscriptions/Packagist/ghostwriter/container'); // Subscribe to a project: Subscribe to receive notifications about new releases of a project. $client->post('subscriptions/Packagist/ghostwriter/container'); // Check if subscribed to a project: Check if a users is subscribed to receive notifications about new releases of a project. $client->get('subscriptions/Packagist/ghostwriter/container'); // Update a subscription: Update the options for a subscription. $client->put('subscriptions/Packagist/ghostwriter/container'); // Unsubscribe from a project: Stop receiving release notifications from a project. $client->delete('subscriptions/Packagist/ghostwriter/container');
Notes
api_keyis added to every request automatically.User-AgentandX-Request-Idheaders are added to every request automatically.
Environment variables
If you resolve the client through the container provider/factories, these variables are used:
LIBRARIES_IO_TOKEN(required)LIBRARIES_IO_BASE_URI(optional, defaults tohttps://libraries.io/api/)
Credits
Changelog
Please see CHANGELOG.md for more information on what has changed recently.
License
Please see LICENSE for more information on the license that applies to this project.
Security
Please see SECURITY.md for more information on security disclosure process.