PHPackages                             akira/laravel-packagist - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. akira/laravel-packagist

ActiveLibrary[API Development](/categories/api)

akira/laravel-packagist
=======================

A modular SDK and Laravel integration for the Packagist.org API with typed DTOs, configurable caching strategies, and static analysis level max

v1.0.0(6mo ago)495MITPHPPHP ^8.4CI failing

Since Oct 30Pushed 6mo ago1 watchersCompare

[ Source](https://github.com/akira-io/laravel-packagist)[ Packagist](https://packagist.org/packages/akira/laravel-packagist)[ GitHub Sponsors](https://github.com/kidiatoliny)[ Patreon](https://www.patreon.com/kidiatoliny)[ RSS](/packages/akira-laravel-packagist/feed)WikiDiscussions 1.x Synced 1mo ago

READMEChangelog (1)Dependencies (13)Versions (2)Used By (0)

Laravel Packagist SDK
=====================

[](#laravel-packagist-sdk)

A modular SDK and Laravel integration for the [Packagist.org](https://packagist.org) API with typed DTOs, configurable caching strategies, and static analysis level max.

> **Requires [PHP 8.4+](https://php.net/releases/) and [Laravel 12+](https://laravel.com/)**

Features
--------

[](#features)

- **Type-Safe DTOs** — Strict typing with readonly properties and immutability
- **Configurable Cache Strategies** — Multiple caching strategies (remember, revalidate, forever, none)
- **Action Pattern** — Clean separation of concerns with dedicated action classes
- **Full Static Analysis** — PHPStan level max with Larastan
- **Pest Testing** — Comprehensive test coverage with PestPHP
- **Laravel 12 Ready** — Built for modern Laravel applications

Installation
------------

[](#installation)

Install via Composer:

```
composer require akira/laravel-packagist
```

Publish the configuration file:

```
php artisan vendor:publish --provider="Akira\Packagist\Providers\PackagistServiceProvider"
```

Configuration
-------------

[](#configuration)

Edit `config/packagist.php` to customize your setup:

```
return [
    'use' => [
        'driver' => env('PACKAGIST_CACHE_DRIVER'),
        'strategy' => \Akira\Packagist\Cache\RevalidateCache::class,
        'ttl' => (int) env('PACKAGIST_CACHE_TTL', 3600),
        'tags' => ['packagist'],
        'enabled' => (bool) env('PACKAGIST_CACHE_ENABLED', true),
    ],

    'per_action' => [
        'GetPackageAction' => [
            'strategy' => \Akira\Packagist\Cache\ForeverCache::class,
        ],
        'SearchPackagesAction' => [
            'strategy' => \Akira\Packagist\Cache\RememberCache::class,
            'ttl' => 300,
        ],
    ],
];
```

Usage
-----

[](#usage)

### Get Package Information

[](#get-package-information)

```
use Akira\Packagist\Facades\Packagist;

$package = Packagist::package('laravel/framework');

echo $package->name;                    // 'laravel/framework'
echo $package->description;             // 'The Laravel Framework'
echo $package->downloads['total'];      // total downloads
echo $package->downloads['monthly'];    // monthly downloads
echo $package->downloads['daily'];      // daily downloads
echo $package->favers;                  // total favorites
```

### Search Packages

[](#search-packages)

```
$results = Packagist::search('laravel', [
    'type' => 'library',
    'tags' => ['framework'],
    'sort' => 'downloads',
]);

foreach ($results['results'] as $package) {
    echo $package['name'];
}
```

### Get Statistics

[](#get-statistics)

```
$stats = Packagist::stats(['period' => 'monthly']);
```

### Get Package Maintainers

[](#get-package-maintainers)

```
$maintainers = Packagist::maintainers('laravel/framework');

foreach ($maintainers as $maintainer) {
    echo $maintainer['name'];
    echo $maintainer['email'];
}
```

Cache Strategies
----------------

[](#cache-strategies)

### RevalidateCache (Default)

[](#revalidatecache-default)

Uses Laravel's cache `remember()` method with optional TTL revalidation.

```
'strategy' => \Akira\Packagist\Cache\RevalidateCache::class,
```

### RememberCache

[](#remembercache)

Standard cache remember with configurable TTL (default: 3600 seconds).

```
'strategy' => \Akira\Packagist\Cache\RememberCache::class,
'ttl' => 300, // 5 minutes
```

### ForeverCache

[](#forevercache)

Caches indefinitely until manually cleared.

```
'strategy' => \Akira\Packagist\Cache\ForeverCache::class,
```

### NoneCache

[](#nonecache)

Disables caching entirely.

```
'strategy' => \Akira\Packagist\Cache\NoneCache::class,
```

Custom Cache Implementation
---------------------------

[](#custom-cache-implementation)

Implement the `CacheContract` to create your own caching strategy:

```
use Akira\Packagist\Contracts\CacheContract;

class CustomCache implements CacheContract
{
    public function get(string $key, callable $callback, int $ttl = 0, ?string $action = null): mixed
    {
        return $callback();
    }

    public function forget(string $key): void
    {
        // Custom logic
    }
}
```

Register in config:

```
'strategy' => CustomCache::class,
```

Custom HTTP Client
------------------

[](#custom-http-client)

Implement the `ClientContract` for custom HTTP handling:

```
use Akira\Packagist\Contracts\ClientContract;

class CustomClient implements ClientContract
{
    public function get(string $endpoint): mixed
    {
        // Custom implementation
    }

    public function search(string $query, array $filters = []): mixed
    {
        // Custom implementation
    }
}
```

Use it:

```
$manager = new PackagistManager(config('packagist'));
$manager->withClient(new CustomClient());
```

Testing
-------

[](#testing)

Run the test suite:

```
composer test
```

Run tests with coverage:

```
composer test:coverage
```

Type coverage check:

```
composer test:type-coverage
```

Code Quality
------------

[](#code-quality)

Format code with **Pint**:

```
composer lint
```

Refactor with **Rector**:

```
composer refactor
```

Static analysis with **PHPStan**:

```
composer test:types
```

Check refactoring rules:

```
composer test:refactor
```

API Reference
-------------

[](#api-reference)

### Packagist Facade

[](#packagist-facade)

- `package(string $name): PackageDTO` — Get package information
- `search(string $query, array $filters = []): array` — Search packages
- `stats(array $filters = []): array` — Get statistics
- `maintainers(string $package): array` — Get package maintainers
- `withClient(ClientContract $client): PackagistManager` — Use custom HTTP client
- `withCache(CacheContract $cache): PackagistManager` — Use custom cache strategy

### DTOs

[](#dtos)

#### PackageDTO

[](#packagedto)

- `name: string`
- `description: string`
- `repository: ?string`
- `versions: array`
- `maintainers: array`
- `homepage: ?string`
- `license: ?string`
- `downloads: array` — Download statistics with `total`, `monthly`, `daily`
- `favers: int`

#### VersionDTO

[](#versiondto)

- `version: string`
- `name: string`
- `description: string`
- `require: string`
- `keywords: array`
- `homepage: ?string`
- `license: ?string`
- `authors: array`

#### MaintainerDTO

[](#maintainerdto)

- `name: string`
- `email: string`
- `homepage: ?string`

License
-------

[](#license)

The MIT License (MIT). See LICENSE file for details.

Support
-------

[](#support)

For issues, questions, or contributions, visit the [GitHub repository](https://github.com/akira/laravel-packagist).

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance67

Regular maintenance activity

Popularity13

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

194d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c42e59ca0b3864a382dc0c3e290f8cf7d75bbe3eab10a3af0f71d5785f89d0bc?d=identicon)[kidiatoliny](/maintainers/kidiatoliny)

---

Top Contributors

[![kidiatoliny](https://avatars.githubusercontent.com/u/48266788?v=4)](https://github.com/kidiatoliny "kidiatoliny (44 commits)")

---

Tags

composerapilaravelsdkpackagistpackage management

###  Code Quality

TestsPest

Static AnalysisPHPStan, Rector

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/akira-laravel-packagist/health.svg)

```
[![Health](https://phpackages.com/badges/akira-laravel-packagist/health.svg)](https://phpackages.com/packages/akira-laravel-packagist)
```

###  Alternatives

[mollie/laravel-mollie

Mollie API client wrapper for Laravel &amp; Mollie Connect provider for Laravel Socialite

3624.1M28](/packages/mollie-laravel-mollie)[saloonphp/laravel-plugin

The official Laravel plugin for Saloon

765.7M125](/packages/saloonphp-laravel-plugin)[mozex/anthropic-laravel

Anthropic PHP for Laravel is a supercharged PHP API client that allows you to interact with the Anthropic API

71226.4k1](/packages/mozex-anthropic-laravel)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
