New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

nasyrov/laravel-interactions

Laravel package for interactions.
126 6

Larablocks Analysis

nasyrov/laravel-interactions works with Laravel 5 (latest release v1.0.5, Mar 26, 2018), which reached end of life: no more fixes, even for security.

Recommendation checks

Not advised

Not advised: no release or commit in over 2 years.

  • No release or commit in over 2 years
  • Supports only Laravel 5, past end of life
  • No release in the last 12 months (last: Mar 26, 2018)
  • 0 downloads a month (needs 10,000)
  • 6 GitHub stars (needs 100)

State

Likely abandoned
  • No release or commit in over 2 years.
  • Last stable release: Mar 26, 2018.
  • No releases in the last 12 months.
  • First released: Jun 13, 2017.
  • 0 open issues on GitHub.

Data from Packagist and GitHub, checked by Larablocks on Nov 27, 2026.

Install
composer require nasyrov/laravel-interactions
Latest Version:v1.0.5
PHP:>=7.0
Laravel:5
License:MIT
Last Updated:Apr 4, 2018
Links: GitHub  ·  Packagist
Maintainer: nasyrov

Laravel Interactions

Latest Version on Packagist Software License Build Status Coverage Status Quality Score Total Downloads

Laravel package for interactions.

Requirements

Make sure all dependencies have been installed before moving on:

Install

Pull the package via Composer:

$ composer require nasyrov/laravel-interactions

Register the service provider in config/app.php:

'providers' => [
    ...
    Nasyrov\Laravel\Interactions\InteractionServiceProvider::class,
    ...
]

Usage

Let's generate a typical user registration flow with the use of interactions.

First, generate a RegisterUser interaction via the command:

$ php artisan make:interaction RegisterUser

The command above will create a new file app/Interactions/RegisterUser.php. Let's open the file and tailor it for our needs – create a new user:

use App\User;
use Illuminate\Http\Request;
use Nasyrov\Laravel\Interactions\Contracts\Interaction;

class RegisterUser implements Interaction
{
    /**
     * Handle the interaction.
     *
     * @return mixed
     */
    public function handle(Request $request)
    {
        return User::create([
            'name' => $request->name,
            'email' => $request->email,
            'password' => bcrypt($request->password),
        ]);
    }
}

Next, include the CallsInteractions trait into the base controller so we will be able to run the interactions in any other controller that extends the one:

use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Nasyrov\Laravel\Interactions\CallsInteractions;

class Controller extends BaseController
{
    use AuthorizesRequests, DispatchesJobs, CallsInteractions, ValidatesRequests;
}

Finally, in the UsersController controller run the RegisterUser interaction and pass the request object:

use App\Http\Controllers\Controller;
use App\Interaction\RegisterUser;
use Illuminate\Http\Request;

class UsersController extends Controller
{
    public function register(RegisterUserRequest $request)
    {
        return $this->interact(RegisterUser::class, [$request]);
    }
}

Testing

$ composer lint
$ composer test

Security

If you discover any security related issues, please email inasyrov@ya.ru instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

Related Packages

multicaret/laravel-acquaintances

This light package, with no dependencies, gives Eloquent models the ability to m...

343,455 850
doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database s...

670,032,257 9,703
laravel/framework

The Laravel Framework.

640,572,096 35,338
laravel/tinker

Powerful REPL for the Laravel framework.

546,909,908 7,440
laravel/serializable-closure

Laravel Serializable Closure provides an easy and secure way to serialize closur...

465,816,364 607

Version History

Version Released PHP Laravel License
v1.0.5 >=7.0 5.5.*|5.6.* MIT
v1.0.4 >=7.0 5.5.* MIT
v1.0.3 >=7.0 5.5.* MIT
v1.0.2 >=5.6.4 5.4.* MIT
v1.0.1 >=5.6.4 ~5.4 MIT