PHPackages                             annotation/larscan - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. annotation/larscan

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

annotation/larscan
==================

Implement a Laravel scanner that can scan by namespace or path and instantiate classes annotated with specific annotations based on PHP 8.0's annotation feature.

v1.1.0(1y ago)02.1kMITPHPPHP ^8.0

Since Jan 15Pushed 1y ago1 watchersCompare

[ Source](https://github.com/dependencies-packagist/annotation-larscan)[ Packagist](https://packagist.org/packages/annotation/larscan)[ Docs](https://github.com/dependencies-packagist/annotation-larscan)[ RSS](/packages/annotation-larscan/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (4)Versions (4)Used By (0)

Annotation Scannable
====================

[](#annotation-scannable)

Implement a Laravel scanner that can scan by namespace or path and instantiate classes annotated with specific annotations based on PHP 8.0's annotation feature.

[![GitHub Tag](https://camo.githubusercontent.com/bcd684bedad75114e8c95f33b78ae4cb90c3c11a63d589564a707842ef6fa6c4/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f7461672f646570656e64656e636965732d7061636b61676973742f616e6e6f746174696f6e2d6c61727363616e)](https://github.com/dependencies-packagist/annotation-larscan/tags)[![Total Downloads](https://camo.githubusercontent.com/a65d42d83ae2039e6aa65b1999486b4498fffc2b7ae2a2630ad8f0ea6b7335e6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f616e6e6f746174696f6e2f6c61727363616e3f7374796c653d666c61742d737175617265)](https://packagist.org/packages/annotation/larscan)[![Packagist Version](https://camo.githubusercontent.com/39d2563b2ae87b9311f7ce4b8921bcc3b4fee32c131b6815ff9e1a6b1b3982a3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f616e6e6f746174696f6e2f6c61727363616e)](https://packagist.org/packages/annotation/larscan)[![Packagist PHP Version Support](https://camo.githubusercontent.com/fddf453f2773058417356e2b834e01a56512c928f71c8cea333eba1841ce99fd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f616e6e6f746174696f6e2f6c61727363616e)](https://github.com/dependencies-packagist/annotation-larscan)[![Packagist License](https://camo.githubusercontent.com/dd1b9b7c28e1f8a19e52967a1118fc506e6abcef6848105de3496f49b8149946/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f646570656e64656e636965732d7061636b61676973742f616e6e6f746174696f6e2d6c61727363616e)](https://github.com/dependencies-packagist/annotation-larscan)

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

[](#installation)

You can install the package via [Composer](https://getcomposer.org/):

```
composer require annotation/larscan
```

Usage
-----

[](#usage)

### Instantiation method

[](#instantiation-method)

```
use Annotation\Scannable\Attributes\Scan;
use Annotation\Scannable\Attributes\ScanFile;
use Annotation\Scannable\Attributes\ScanNamespace;
use Annotation\Scannable\Attributes\ScanPath;
use Annotation\Scannable\Attributes\ScanPackageNamespace;

public function scan(): void
{
    // ScanPackageNamespace
    $scan = new ScanPackageNamespace(['GuzzleHttp']);

    // ScanNamespace
    $scan = new ScanNamespace(['Illuminate\Support\Arr']);
    $scan = new ScanNamespace(['Illuminate\Support*']);

    // ScanPath
    $scan = new ScanPath(__DIR__.'/../Http/');
    $scan = new ScanPath(new \RecursiveDirectoryIterator(__DIR__.'/../Http/Controllers'));

    // ScanFile
    $scan = new ScanFile(__FILE__);
    $scan = new ScanFile(new \SplFileInfo(__DIR__ . '/AppServiceProvider.php'));

    // Scan
    $scan = new Scan('Illuminate\Support\Arr');
    $scan = new Scan(['Illuminate\Support\Arr']);
    $scan = new Scan(new \ReflectionClass('Illuminate\Support\Arr'));
}
```

### Annotation method

[](#annotation-method)

> Only supports Laravel framework

```
use Annotation\Scannable\Attributes\Scan;
use Annotation\Scannable\Attributes\ScanFile;
use Annotation\Scannable\Attributes\ScanNamespace;
use Annotation\Scannable\Attributes\ScanPath;
use Annotation\Scannable\Attributes\ScanPackageNamespace;
use Rfc\Scannable\Contracts\Scannable;

#[ScanPackageNamespace(['GuzzleHttp'])]

#[ScanNamespace(['Illuminate\Support\Arr'])]
#[ScanNamespace(['Illuminate\Support*'])]

#[ScanPath(__DIR__.'/../Http/')]
#[ScanPath(new \RecursiveDirectoryIterator(__DIR__.'/../Http/Controllers'))]

#[ScanFile(__FILE__)]
#[ScanFile(new \SplFileInfo(__DIR__ . '/AppServiceProvider.php'))]

#[Scan('Illuminate\Support\Arr')]
#[Scan(['Illuminate\Support\Arr'])]
#[Scan(new \ReflectionClass('Illuminate\Support\Arr'))]
class AppServiceProvider extends ServiceProvider implements Scannable
{
    //
}
```

```
use Annotation\Scannable\Attributes\ScanNamespace;
use Annotation\Scannable\Attributes\ScanPackageNamespace;
use Annotation\Scannable\Contracts\Scanner;
use Annotation\Scannable\Facades\Scan;

public function scan(Scanner $scan): void
{
    $namespace = $scan->using(ScanPackageNamespace::class, function (ScanPackageNamespace $scanNamespace) {
        return $scanNamespace->getReflectionClass();
    });
    //dump($namespace);
    $namespace = Scan::using(ScanNamespace::class, function (ScanNamespace $namespace) {
        return $namespace->getNamespace();
    });
    //dump($namespace);
}
```

License
-------

[](#license)

Nacosvel Contracts is made available under the MIT License (MIT). Please see [License File](LICENSE) for more information.

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance42

Moderate activity, may be stable

Popularity15

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity45

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 ~2 days

Total

3

Last Release

484d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2da9b458375a1b7972b7c4d26a5bf8f3e48db305e8805da36f253956f33c5568?d=identicon)[jundayw](/maintainers/jundayw)

---

Top Contributors

[![jundayw](https://avatars.githubusercontent.com/u/16873970?v=4)](https://github.com/jundayw "jundayw (16 commits)")

---

Tags

laravelattributesannotationscannerscanScannable

### Embed Badge

![Health badge](/badges/annotation-larscan/health.svg)

```
[![Health](https://phpackages.com/badges/annotation-larscan/health.svg)](https://phpackages.com/packages/annotation-larscan)
```

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M687](/packages/barryvdh-laravel-ide-helper)[glhd/conveyor-belt

14797.0k](/packages/glhd-conveyor-belt)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)[interaction-design-foundation/laravel-geoip

Support for multiple Geographical Location services.

17221.0k3](/packages/interaction-design-foundation-laravel-geoip)[frittenkeez/laravel-vouchers

Voucher system for Laravel 9+

5819.9k2](/packages/frittenkeez-laravel-vouchers)

PHPackages © 2026

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