{"id":13828226,"url":"https://github.com/spatie/packagist-api","last_synced_at":"2025-05-15T13:06:39.898Z","repository":{"id":8379878,"uuid":"58189408","full_name":"spatie/packagist-api","owner":"spatie","description":"The easiest way to work with the packagist API","archived":false,"fork":false,"pushed_at":"2025-03-21T09:22:32.000Z","size":144,"stargazers_count":127,"open_issues_count":0,"forks_count":21,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-04-12T03:45:12.247Z","etag":null,"topics":["api","packagist","php"],"latest_commit_sha":null,"homepage":"https://spatie.be/open-source/packages","language":"PHP","has_issues":false,"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/spatie.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.md","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},"funding":{"github":"spatie","custom":"https://spatie.be/open-source/support-us"}},"created_at":"2016-05-06T07:32:06.000Z","updated_at":"2025-04-04T04:41:05.000Z","dependencies_parsed_at":"2025-04-12T02:59:37.042Z","dependency_job_id":"8915847f-126a-429b-9cc5-8b25e3497d25","html_url":"https://github.com/spatie/packagist-api","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spatie%2Fpackagist-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spatie%2Fpackagist-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spatie%2Fpackagist-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spatie%2Fpackagist-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/spatie","download_url":"https://codeload.github.com/spatie/packagist-api/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254346624,"owners_count":22055808,"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":["api","packagist","php"],"created_at":"2024-08-04T09:02:37.385Z","updated_at":"2025-05-15T13:06:39.848Z","avatar_url":"https://github.com/spatie.png","language":"PHP","readme":"# Fetch package info from Packagist\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/spatie/packagist-api.svg?style=flat-square)](https://packagist.org/packages/spatie/packagist-api)\n[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md)\n![GitHub Workflow Status](https://img.shields.io/github/workflow/status/spatie/packagist-api/run-tests?label=tests)\n[![Total Downloads](https://img.shields.io/packagist/dt/spatie/packagist-api.svg?style=flat-square)](https://packagist.org/packages/spatie/packagist-api)\n\nThis package makes it easy to search and fetch package info using [the Packagist API](https://packagist.org/apidoc).\n\n## Support us\n\n[\u003cimg src=\"https://github-ads.s3.eu-central-1.amazonaws.com/packagist-api.jpg?t=1\" width=\"419px\" /\u003e](https://spatie.be/github-ad-click/packagist-api)\n\nWe invest a lot of resources into creating [best in class open source packages](https://spatie.be/open-source). You can support us by [buying one of our paid products](https://spatie.be/open-source/support-us).\n\nWe highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on [our contact page](https://spatie.be/about-us). We publish all received postcards on [our virtual postcard wall](https://spatie.be/open-source/postcards).\n\n## Installation\n\nYou can install the package via composer:\n\n``` bash\ncomposer require spatie/packagist-api\n```\n\nThere is also a [Laravel wrapper](https://packagist.org/packages/markwalet/laravel-packagist) available for this package.\n## Usage\n\nYou must pass a Guzzle client and a url generator to the constructor of `Spatie\\Packagist\\PackagistClient`.\n\n```php\n$client = new \\GuzzleHttp\\Client();\n$generator = new \\Spatie\\Packagist\\PackagistUrlGenerator();\n\n$packagist = new \\Spatie\\Packagist\\PackagistClient($client, $generator);\n```\n\n### List package names\n```php\n// All packages\n$packagist-\u003egetPackagesNames();\n\n// List packages by type.\n$packagist-\u003egetPackagesNamesByType('composer-plugin');\n\n// List packages by organization\n$packagist-\u003egetPackagesNamesByVendor('spatie');\n```\n\n### List popular packages\n```php\n// List first page of popular packages\n$packagist-\u003egetPopularPackages();\n```\n\n#### Pagination\nListing popular packages returns a paginated result. You can change the pagination settings by adding more parameters.\n\n```php\n// Get the third page, 10 items per page.\n$packagist-\u003egetPopularPackages(3, 10);\n```\n\n### Searching for packages\n```php\n// Search packages by name.\n$packagist-\u003esearchPackagesByName('packagist');\n\n// Search packages by tag.\n$packagist-\u003esearchPackagesByTags('psr-3');\n\n// Search packages by type.\n$packagist-\u003esearchPackagesByType('composer-plugin');\n\n// Combined search.\n$packagist-\u003esearchPackages('packagist', ['type' =\u003e 'library']);\n```\n\n#### Pagination\nSearching for packages returns a paginated result. You can change the pagination settings by adding more parameters.\n\n```php\n// Get the third page, 10 items per page.\n$packagist-\u003esearchPackagesByName('packagist', 3, 10);\n```\n\n### Getting package data.\n```php\n// Using the Composer metadata. (faster, but less data)\n$packagist-\u003egetPackageMetadata('spatie/packagist-api');\n$packagist-\u003egetPackageMetadata('spatie', 'packagist-api');\n\n// Using the Composer metadata for dev branches.\n$packagist-\u003egetPackageMetadata('spatie', 'packagist-api', true);\n\n// Using the API. (slower, cached for 12 hours by Packagist.\n$packagist-\u003egetPackage('spatie/packagist-api');\n$packagist-\u003egetPackage('spatie', 'packagist-api');\n```\n\n### Get package download stats\n```php\n$packagist-\u003egetPackageDownloadStats('spatie/packagist-api');\n$packagist-\u003egetPackageDownloadStats('spatie', 'packagist-api');\n```\n\n### Get Statistics\n```php\n$packagist-\u003egetStatistics();\n```\n\n### Get security vulnerability advisories\n```php\n// Get advisories for specific packages\n$packages = ['spatie/packagist-api'];\n$advisories = $packagist-\u003egetAdvisories($packages);\n\n// Get advisories for specific packages that were updated after some timestamp\n$packages = ['spatie/packagist-api'];\n$advisories = $packagist-\u003egetAdvisories($packages, strtotime('2 weeks ago'));\n\n// Get advisories only for specific versions of specific packages\n$packages = ['spatie/packagist-api' =\u003e '2.0.2'];\n$advisories = $packagist-\u003egetAdvisoriesAffectingVersions($packages);\n```\n\n## Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.\n\n## Testing\n\n``` bash\ncomposer test\n```\n\n## Contributing\n\nPlease see [CONTRIBUTING](https://github.com/spatie/.github/blob/main/CONTRIBUTING.md) for details.\n\n## Security\n\nIf you've found a bug regarding security please mail [security@spatie.be](mailto:security@spatie.be) instead of using the issue tracker.\n\n## Credits\n\n- [Freek Van der Herten](https://github.com/freekmurze)\n- [Jolita Grazyte](https://github.com/JolitaGrazyte)\n- [Mark Walet](https://github.com/markwalet)\n- [All Contributors](../../contributors)\n\n## About Spatie\nSpatie is a webdesign agency based in Antwerp, Belgium. You'll find an overview of all our open source projects [on our website](https://spatie.be/opensource).\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","funding_links":["https://github.com/sponsors/spatie","https://spatie.be/open-source/support-us"],"categories":["PHP"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspatie%2Fpackagist-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspatie%2Fpackagist-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspatie%2Fpackagist-api/lists"}