PHPackages                             brayancaro/laravel-api-rule - 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. brayancaro/laravel-api-rule

ActiveLibrary[API Development](/categories/api)

brayancaro/laravel-api-rule
===========================

Easy API calls within Laravel rules.

v2.0.0(2y ago)1288↑1400%[3 PRs](https://github.com/BrayanCaro/laravel-api-rule/pulls)MITPHPPHP ^8.0CI passing

Since Mar 13Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/BrayanCaro/laravel-api-rule)[ Packagist](https://packagist.org/packages/brayancaro/laravel-api-rule)[ Docs](https://github.com/brayancaro/laravel-api-rule)[ RSS](/packages/brayancaro-laravel-api-rule/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (9)Dependencies (10)Versions (15)Used By (0)

Easy API calls within Laravel rules.
====================================

[](#easy-api-calls-within-laravel-rules)

[![Latest Version on Packagist](https://camo.githubusercontent.com/598fa5b91c8a225015dedb0d00443521496607d37da074c7b2cd49400b7e10a6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f62726179616e6361726f2f6c61726176656c2d6170692d72756c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/brayancaro/laravel-api-rule)[![GitHub Tests Action Status](https://camo.githubusercontent.com/a241dbecfc53e7caad8c58dc07f02c2840d907ef21d3b00f6da125e7ab92ad8d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f62726179616e6361726f2f6c61726176656c2d6170692d72756c652f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/brayancaro/laravel-api-rule/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/64071f6f555c61d271da0b575c8a07493ef5a6577032372e5310a622a1f5b549/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f62726179616e6361726f2f6c61726176656c2d6170692d72756c652f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/brayancaro/laravel-api-rule/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/b153e4af9d7ff2ac04d807d1e76633a6dfda5b431bce0260c6b59af49d7bc26a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f62726179616e6361726f2f6c61726176656c2d6170692d72756c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/brayancaro/laravel-api-rule)

Easy API calls within Laravel rules.

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

[](#installation)

You can install the package via composer:

```
composer require brayancaro/laravel-api-rule
```

Usage
-----

[](#usage)

```
# Create a rule
use BrayanCaro\ApiRule\ApiRule;
use Illuminate\Http\Client\Response;
use Illuminate\Support\Facades\Http;

class DummyRule extends ApiRule
{
    protected function pullResponse($value): Response
    {
        return Http::get("dummy.com/$value");
    }
}
```

And use it as a normal rule:

```
public function store(Request $request)
{
    $validated = $request->validate([
        'some_attribute' => ['required', DummyRule::make()],
        # ...
    ]);

    # ...
}
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Brayan Martínez Santana](https://github.com/BrayanCaro)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance59

Moderate activity, may be stable

Popularity14

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 74.3% 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 ~48 days

Total

9

Last Release

769d ago

Major Versions

v0.2.0 → v1.0.02023-10-09

v1.1.0 → v2.0.02024-03-31

PHP version history (3 changes)v0.0.0PHP ^7.4 || ^8.0

v1.0.0PHP ^7.3 || ^8.0

v2.0.0PHP ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/034a63ac2d024b766a23cb45fb508038dc3b1e85955b55eb0f5a400860115739?d=identicon)[BrayanCaro](/maintainers/BrayanCaro)

---

Top Contributors

[![BrayanCaro](https://avatars.githubusercontent.com/u/41640423?v=4)](https://github.com/BrayanCaro "BrayanCaro (75 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (17 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (9 commits)")

---

Tags

laravelBrayanCarolaravel-api-rule

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/brayancaro-laravel-api-rule/health.svg)

```
[![Health](https://phpackages.com/badges/brayancaro-laravel-api-rule/health.svg)](https://phpackages.com/packages/brayancaro-laravel-api-rule)
```

###  Alternatives

[andreaselia/laravel-api-to-postman

Generate a Postman collection automatically from your Laravel API

1.0k586.2k3](/packages/andreaselia-laravel-api-to-postman)[mll-lab/laravel-graphiql

Easily integrate GraphiQL into your Laravel project

683.2M9](/packages/mll-lab-laravel-graphiql)[scalar/laravel

Render your OpenAPI-based API reference

6183.9k2](/packages/scalar-laravel)[ryangjchandler/bearer

Minimalistic token-based authentication for Laravel API endpoints.

8129.8k](/packages/ryangjchandler-bearer)[combindma/laravel-facebook-pixel

Meta pixel integration for Laravel

4956.9k](/packages/combindma-laravel-facebook-pixel)[stechstudio/laravel-hubspot

A Laravel SDK for the HubSpot CRM Api

2971.0k](/packages/stechstudio-laravel-hubspot)

PHPackages © 2026

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