PHPackages                             haykel/laravel-action-maker - 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. [Testing &amp; Quality](/categories/testing)
4. /
5. haykel/laravel-action-maker

ActiveLibrary[Testing &amp; Quality](/categories/testing)

haykel/laravel-action-maker
===========================

A Laravel package to generate Action classes with optional DB transactions and Pest tests.

v1.1.1(5mo ago)01MITPHPPHP ^8.0

Since Nov 20Pushed 5mo agoCompare

[ Source](https://github.com/HaykelRekik/laravel-action-class-maker)[ Packagist](https://packagist.org/packages/haykel/laravel-action-maker)[ RSS](/packages/haykel-laravel-action-maker/feed)WikiDiscussions master Synced 1mo ago

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

Laravel Action Maker
====================

[](#laravel-action-maker)

[![Latest Version on Packagist](https://camo.githubusercontent.com/15289f0022d6ad4bbeadc2b5473b54de224e0bd196d989b9688d1b10f734be02/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6861796b656c2f6c61726176656c2d616374696f6e2d6d616b65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/haykel/laravel-action-maker)[![Total Downloads](https://camo.githubusercontent.com/eb2dc4539ba9b3e00093c6a05a22fd57f19d0ab5e63486f5e1a78cca40468158/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6861796b656c2f6c61726176656c2d616374696f6e2d6d616b65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/haykel/laravel-action-maker)[![Tests](https://camo.githubusercontent.com/ccb8c634d1faf3dedc1414d9aa9564de442f9362edb95005fe1316c41853c261/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f4861796b656c52656b696b2f6c61726176656c2d616374696f6e2d6d616b65722f74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/HaykelRekik/laravel-action-maker/actions)

A Laravel package to generate Action classes with automatic transaction handling, custom namespaces, and Pest test generation.

Features
--------

[](#features)

- **Transactions by Default**: Automatically wraps logic in `DB::transaction` (configurable)
- **Smart Naming**: Auto-appends configurable suffixes (e.g., `CreateUser` → `CreateUserAction`)
- **Folder Support**: Easily organize actions into subfolders via `--folder`
- **Test Generation**: Generates a corresponding Pest unit test with `--with-test`
- **Customizable**: Publishable stubs and configuration
- **Laravel 10, 11, &amp; 12**: Works with modern Laravel versions
- **PHP 8.1+**: Supports PHP 8.1, 8.2, and 8.3

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

[](#installation)

You can install the package via composer:

```
composer require haykel/laravel-action-maker
```

The package will automatically register itself via Laravel's package auto-discovery.

### Publish Configuration (Optional)

[](#publish-configuration-optional)

To customize the default behavior, publish the configuration file:

```
php artisan vendor:publish --tag=action-maker-config
```

This will create `config/action-maker.php` where you can customize:

- Default namespace for actions
- Class suffix
- Transaction behavior
- Test generation preferences

### Publish Stubs (Optional)

[](#publish-stubs-optional)

To customize the generated code templates:

```
php artisan vendor:publish --tag=action-maker-stubs
```

This will publish `stubs/action.stub` and `stubs/pest.stub` to your project root.

Usage
-----

[](#usage)

### Basic Action

[](#basic-action)

```
php artisan make:action CreateUser
```

**Result:** `app/Actions/CreateUserAction.php`

```
