PHPackages                             thettler/laravel-command-attribute-syntax - 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. [CLI &amp; Console](/categories/cli)
4. /
5. thettler/laravel-command-attribute-syntax

AbandonedArchivedLibrary[CLI &amp; Console](/categories/cli)

thettler/laravel-command-attribute-syntax
=========================================

This Package allows the use of PHP Attributes to specify a command signature

2.0.0(4y ago)881[1 PRs](https://github.com/thettler/laravel-command-attribute-syntax/pulls)MITPHPPHP ^8.1

Since Jan 26Pushed 3y ago1 watchersCompare

[ Source](https://github.com/thettler/laravel-command-attribute-syntax)[ Packagist](https://packagist.org/packages/thettler/laravel-command-attribute-syntax)[ Docs](https://github.com/thettler/laravel-command-attribute-syntax)[ GitHub Sponsors](https://github.com/thettler)[ RSS](/packages/thettler-laravel-command-attribute-syntax/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (14)Versions (4)Used By (0)

❌❌THIS REPO IS NO LONGER SUPPORTED PLEASE USE  ❌❌

Laravel Command Attribute Syntax
================================

[](#laravel-command-attribute-syntax)

[![Latest Version on Packagist](https://camo.githubusercontent.com/34171aeb10a16fd90ed31cd60018c755fdfb349b5326afa2bee1c353768b68c7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f74686574746c65722f6c61726176656c2d636f6d6d616e642d6174747269627574652d73796e7461782e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/thettler/laravel-command-attribute-syntax)[![GitHub Tests Action Status](https://camo.githubusercontent.com/bcb28aa4c1beb2f146e83955178fc69d569bfdaf9cbce4db5137d3abf7b5e645/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f74686574746c65722f6c61726176656c2d636f6d6d616e642d6174747269627574652d73796e7461782f72756e2d74657374733f6c6162656c3d7465737473)](https://github.com/thettler/laravel-command-attribute-syntax/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/5221c589396b74161a04e0ed3cb511f8ee61006e52214a4f60ded503b5aed965/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f74686574746c65722f6c61726176656c2d636f6d6d616e642d6174747269627574652d73796e7461782f436865636b253230262532306669782532307374796c696e673f6c6162656c3d636f64652532307374796c65)](https://github.com/thettler/laravel-command-attribute-syntax/actions?query=workflow%3A%22Check+%26+fix+styling%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/f85d9dd2beb13bbd37e160e67b9140e10c1e413534a1d001fb851f656787b5b4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f74686574746c65722f6c61726176656c2d636f6d6d616e642d6174747269627574652d73796e7461782e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/thettler/laravel-command-attribute-syntax)

[![Header Image](/.github/header_img.png)](/.github/header_img.png)

This package lets you use PHP Attributes to define your Arguments and Options on Artisan Commands. You do not need to touch the `handle()` method in existing commands in order to use this package. Supports all Laravel features and more:

- Negatable Options
- Required Value Options
- Enum Types
- Casting

💜 Support me
------------

[](#purple_heart--support-me)

Visit my blog on  or follow me on Social Media [Twitter @bitbench](https://twitter.com/bitbench)[Instagram @bitbench.dev](https://www.instagram.com/bitbench.dev/)

📦 Installation
--------------

[](#package--installation)

You can install the package via composer:

```
composer require thettler/laravel-command-attribute-syntax
```

🔧 Usage
-------

[](#wrench--usage)

> 🗯️ Before you use this package you should already have an understanding of Artisan Commands. You can read about them [here](https://laravel.com/docs/8.x/artisan).

### A Basic Command

[](#a-basic-command)

To use the attributes in your commands you first need to replace the default `\Illuminate\Console\Command` class with `Thettler\LaravelCommandAttributeSyntax\Command`. Then add the `Thettler\LaravelCommandAttributeSyntax\Attributes\CommandAttribute` to the class.

The `CommandAttribute` requires the `name` parameter to be set. This will be the name of the Command which you can use to call it from the commandline.

```
