🧙‍♀️ Arcanist takes the pain out of building multi-step form wizards in Laravel.

Overview

Installation

Arcanist requires PHP 8 and Laravel 8.

composer require laravel-arcanist/arcanist

Documentation

You can find the full documentation here.

Credits

License

MIT

Comments
  • REST API Renderer

    REST API Renderer

    Currently there are renderers available for blade templates and Inertia.js (I am not familiar with this, so bare with me). If I have a JavaScript frontend project (Vue, React, Svelte, etc.) that is separate from the Laravel side, how best would I pass the data back and forth? I suppose I could start with WizardStep::viewData, I would just need to dig into the source code and docs a bit more to figure that out. Are there any caveats I should know about?

    opened by mklein994 9
  • Added omittable steps

    Added omittable steps

    Issue reference: #43

    Please let me know if there's anything I can change here, I've tried to implement this in the most elegant way without having to modify a bunch of logic. I needed this for a personal project, and it works fine as is (afaik), but if there's a better way of doing this without rewriting the entire wizard logic let me know 😂

    opened by ercsctt 7
  • Inertia support

    Inertia support

    Hi there, I see this package very useful for something my company is trying to do

    Also we're using InertiaJS, it will be very nice to have compatibility with this package like the "Custom renderers" (which seems wip in the docs page) and sharing data will be much easier reusing Inertia's methods.

    opened by d8vjork 7
  • Add wizard class as an argument to the onCompleteAction

    Add wizard class as an argument to the onCompleteAction

    The following PR will allow the onCompleteAction class to have information about the wizard in addition to the already available payload.

    E.g.

    <?php
    
    namespace App\Wizards\Registration;
    
    use Arcanist\Action\WizardAction;
    use Arcanist\Action\ActionResult;
    
    class RegistrationAction extends WizardAction
    {
        public function execute($payload, $wizard): ActionResult
        {
            return $this->success();
        }
    }
    
    opened by jorostoyanov 5
  • Action payload doesn't include data from the last step

    Action payload doesn't include data from the last step

    Hi there,

    Firstly, I'm having an amazing time playing with this package, thank you for the time & effort you've put in to it!

    I noticed that I was getting a 500 error when trying to access data in the payload of my Action class but only on the first time I tried to submit, if I refreshed it worked fine.

    I traced this through in the code (AbstractWizard.php) and found that the instance doesn't have access to the updated data yet in processLastStep - I'm assuming it's been persisted but not reloaded/attached to the instance straight away.

    I fixed this on the example I'm working with by reloading the wizard after the saveStepData call in the update function.

    EDIT: I'm also using the inertia-response-renderer package incase that infromation is helpful

    Disclaimer

    It's highly likely I'm using this wrong so if I am, I apologise for wasting your time,

    Cheers!

    bug 
    opened by jamessessford 4
  • Change visibility to protected

    Change visibility to protected

    There are some attributes/methods in the AbstractWizard and WizardStep classes which we need to access in child-classes.

    I've changed their visibility to protected.

    opened by erikwittek 3
  • [REST API Renderer] Wizard Cancel force redirect Response

    [REST API Renderer] Wizard Cancel force redirect Response

    First of all we pushed our Renderer to GitHub today: suenerds/arcanist-rest-api-renderer

    We tried to implement a cancel button today and found a hardcoded redirect response in the Wizard destroy method.

    Idea for a solution: You have build a delete hook for clean up purposes. As we need a way to overwrite the redirect response I want to use the same mechanism for completing the wizard

    /**
         * The action that gets executed after the last step of the
         * wizard is completed.
         */
        protected string $onDeleteAction = NullAction::class;
    
    
    /**
         * Gets called after the last step in the wizard is finished.
         */
        protected function onAfterDelete(ActionResult $result): Response | Responsable | Renderable
        {
            return new JsonResponse([
                'redirect' => [
                    'path' => '/wizard/assignments'
                ]
            ]);
        }
    
     public function destroy(Request $request, string $wizardId): Response | Responsable | Renderable
        {
            $this->load($wizardId);
    
            $result = $this->actionResolver
                ->resolveAction($this->onDeleteAction)
                ->execute($this->transformWizardData());
    
            if (!$result->successful()) {
                return $this->responseRenderer->redirectWithError(
                    $this->currentStep(),
                    $this,
                    $result->error()
                );
            }
    
            $this->wizardRepository->deleteWizard($this);
    
            return $this->onAfterDelete($result);
        }
    

    The Delete Hook will be an Action Class after that and we can use the onAfterDelete function to do whatever we need to do after Delete.

    I will update this issue when my PR is ready.

    opened by thoresuenert 3
  • Migration fails on MySQL 8.0.22

    Migration fails on MySQL 8.0.22

    Publishing then running the migrations fails with the following error:

    SQLSTATE[42000]: Syntax error or access violation: 1101 BLOB, TEXT, GEOMETRY or JSON column 'data' can't have a default value (SQL: create table `wizards` (`id` int unsigned not null auto_increment primary key, `class` varchar(255) not null, `data` json not null default '[]', `created_at` timestamp null, `updated_at` timestamp null) default character set utf8mb4 collate 'utf8mb4_unicode_ci')
    
    bug 
    opened by mintbridge 3
  • Statamic View Support

    Statamic View Support

    This PR adds support for using Wizards in Statamic.

    https://statamic.dev/controllers#antlers-views

    • Added statamic/cms as a dependency.
    • Included Statamic\View\View as a response type where applicable.
    • Added StatamicResponseRenderer and added new config.

    To use this, you need to put the following in the register method of your AppServiceProvider:

    $this->app->bind(StatamicResponseRenderer::class, function () {
                return new StatamicResponseRenderer(
                    config('arcanist.renderers.statamic.view_base_path', 'wizards')
                );
            });
    

    I couldn't figure out a way to put this Response Renderer in its own package because it required a new return type. If there is a better way to organize this, please let me know so I can make changes.

    opened by swilla 2
  • Customize messages and filename

    Customize messages and filename

    Add two methods in WizardSteps:

    • the first one allow to define specific error messages
    • the second one allow to customize the name of the field

    The method results are both used as common arguments validation

    opened by hguenot 2
  • Add $request to Action execute() method

    Add $request to Action execute() method

    It's common to still need access to things like $request->user()->id in the execute() method of an action.

    There is a request() helper but I thought this make things nicer

    I'm also wondering if $payload here can be typehinted as array since you already declared $data as an array in AbstractWizard

    opened by ziming 2
  • UnknownStepException

    UnknownStepException

    Good Morning,

    First off, love the package 👍🏻

    We noticed that we are encountering an issue with the UnknownStepException being triggered if a user decided to change the step slug within the URL. This is of course intentional but is there a way in which we can capture the error and return a NotFoundHttpException instead or redirect the user back to the first step?

    Thanks, Matthew

    opened by matthewmnewman 0
  • Fix firstIncompleteStep when all step are done

    Fix firstIncompleteStep when all step are done

    I don't know how they do but sometimes my users end the workflow but the action seems to be not called. I get an issue Arcanist\AbstractWizard::firstIncompleteStep(): Return value must be of type Arcanist\WizardStep, null returned

    I suppose availableSteps() returns an empty collection and the first method returns null. So I use the last step as default value.

    opened by hguenot 0
  • How to upload files?

    How to upload files?

    Hi,

    I'm experiencing with this package and I have a trouble with file uploading:

    • In WizardAction I'm reading a file field (e.g. avatar) through $payload and i want to do something like Storage::putFile('avatars', $payload['avatar']); to store file in a local storage, but $payload['avatar'] is always an empty array. How to fix that?
    opened by madi-nuralin 5
  • laravel-arcanist/inertia-response-renderer 0.5.0 requires inertiajs/inertia-laravel ^0.4.1 -> found inertiajs/inertia-laravel[v0.4.1, ..., v0.4.5] but it conflicts with your root composer.json require (^0.5.1).

    laravel-arcanist/inertia-response-renderer 0.5.0 requires inertiajs/inertia-laravel ^0.4.1 -> found inertiajs/inertia-laravel[v0.4.1, ..., v0.4.5] but it conflicts with your root composer.json require (^0.5.1).

    Your requirements could not be resolved to an installable set of packages.

    Problem 1
        - Root composer.json requires laravel-arcanist/inertia-response-renderer ^0.5.0 -> satisfiable by laravel-arcanist/inertia-response-renderer[0.5.0].
        - laravel-arcanist/inertia-response-renderer 0.5.0 requires inertiajs/inertia-laravel ^0.4.1 -> found inertiajs/inertia-laravel[v0.4.1, ..., v0.4.5] but it conflicts with your root composer.json require (^0.5.1).
    
    Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions
    
    opened by limsocheat 0
  • Make it possible to validate nested array input

    Make it possible to validate nested array input

    This PR lets you define validation rules for nested array input:

    Field::make('checkboxes')
        ->rules(['checkboxes.*' => 'in:optionA,optionB')
    
    opened by erikwittek 2
Releases(0.8.0)
  • 0.8.0(Jun 23, 2022)

    What's Changed

    • Added omittable steps by @ercsctt in https://github.com/laravel-arcanist/arcanist/pull/44

    New Contributors

    • @ercsctt made their first contribution in https://github.com/laravel-arcanist/arcanist/pull/44

    Full Changelog: https://github.com/laravel-arcanist/arcanist/compare/0.7.0...0.8.0

    Source code(tar.gz)
    Source code(zip)
  • 0.7.0(Apr 15, 2022)

    What's Changed

    • pass request to transformWizardData() by @ziming in https://github.com/laravel-arcanist/arcanist/pull/34

    Full Changelog: https://github.com/laravel-arcanist/arcanist/compare/0.6.0...0.7.0

    Source code(tar.gz)
    Source code(zip)
  • 0.6.0(Mar 16, 2022)

    What's Changed

    • Support Laravel 9 too by @ziming in https://github.com/laravel-arcanist/arcanist/pull/41

    New Contributors

    • @ziming made their first contribution in https://github.com/laravel-arcanist/arcanist/pull/41

    Full Changelog: https://github.com/laravel-arcanist/arcanist/compare/0.5.2...0.6.0

    Source code(tar.gz)
    Source code(zip)
  • 0.5.2(Aug 20, 2021)

    Changed

    • Changed visibility of $responseRenderer from private to protected in AbstractWizard (#21, @erikwittek)
    • Changed visibility of AbstractWizard::fields() method from private to protected (#21, @erikwittek)
    Source code(tar.gz)
    Source code(zip)
  • 0.5.1(Aug 17, 2021)

    Added

    • Added protected onAfterDelete method to AbstractWizard. This method gets called after a wizard was deleted instead of a hardcoded redirect (#20, @erikwittek)
    Source code(tar.gz)
    Source code(zip)
  • 0.5.0(Aug 4, 2021)

    Changed

    • Changed visibility of fields method to public. This should make it possible to have generic templates by looping over the field definitions (#17, @thoresuenert)
    Source code(tar.gz)
    Source code(zip)
  • 0.4.0(Jul 20, 2021)

  • 0.3.1(Jul 15, 2021)

    Changed

    • Use static inside of Field::make() to make it easier to extend from the Field class (#15). This is a potentially breaking change if you've extended from the Field class in your code
    Source code(tar.gz)
    Source code(zip)
  • 0.3.0(May 21, 2021)

    Added

    • Added make:wizard and make:wizard-step commands
    • Added transform method to Field class to register arbitrary callbacks for a field. Note that whatever the callback returns is the value that gets persisted for the field.
    Source code(tar.gz)
    Source code(zip)
  • 0.2.0(May 7, 2021)

    Changed

    • WizardRepository implementations no longer throw an exception when trying to delete a wizard that doesn’t exist. (#1)

    Fixed

    • Data from last step is now available in action (#2)
    • Fix crashing migration in MySQL 8 (#3). This was due to the fact that MySQL 8 doesn't support default values on JSON columns. Since a wizard always gets created with at least an empty array as its data, this can safely be removed.
    Source code(tar.gz)
    Source code(zip)
  • 0.1.0(May 3, 2021)

Owner
Arcanist
Magical multi-step form wizards for Laravel.
Arcanist
Laravel 2-Step Verification is a package to add 2-Step user authentication to any Laravel project easily.

Laravel 2-Step verification is a package to add 2-Step user authentication to any Laravel project easily. It is configurable and customizable. It uses notifications to send the user an email with a 4-digit verification code. Laravel 2-Step Authentication Verification for Laravel. Can be used in out the box with Laravel's authentication scaffolding or integrated into other projects.

Jeremy Kenedy 204 Dec 23, 2022
Laravel Livewire (TALL-stack) form generator with realtime validation, file uploads, array fields, blade form input components and more.

TALL-stack form generator Laravel Livewire, Tailwind forms with auto-generated views. Support Contributions Features This is not an admin panel genera

TinaH 622 Jan 2, 2023
Composer package which adds support for HTML5 elements using Laravels Form interface (e.g. Form::date())

Laravel HTML 5 Inputs Composer package which adds support for HTML5 elements by extending Laravel's Form interface (e.g. Form::date()) Adds support fo

Small Dog Studios 11 Oct 13, 2020
A dynamic Laravel Livewire component for multi steps form

Livewire component that provides you with a wizard that supports multiple steps form while maintaining state.

Vildan Bina 233 Jan 4, 2023
Takes in a HEX color and produces variations of that colour for the foreground and background

css-colors Takes in a HEX color and produces variations of that colour for the foreground and background It takes a great php class made by Patrick Fi

Soapbox Innovations Inc. 9 Jul 24, 2020
Run multiple websites using the same Laravel installation while keeping tenant specific data separated for fully independent multi-domain setups, previously github.com/hyn/multi-tenant

The unobtrusive Laravel package that makes your app multi tenant. Serving multiple websites, each with one or more hostnames from the same codebase. B

Tenancy 2.4k Jan 3, 2023
Taskpm - Run multi tasks by PHP multi process

php-pkg-template Run multi tasks by PHP multi process Install composer composer require phppkg/taskpm Usage github: use the template for quick create

PHPPkg 2 Dec 20, 2021
This package gives you a set of conventions to make the most out of Hotwire in Laravel

Introduction This package gives you a set of conventions to make the most out of Hotwire in Laravel (inspired by the turbo-rails gem). There is a comp

Tony Messias 665 Jan 2, 2023
🖖Repository Pattern in Laravel. The package allows to filter by request out-of-the-box, as well as to integrate customized criteria and any kind of filters.

Repository Repository Pattern in Laravel. The package allows to filter by request out-of-the-box, as well as to integrate customized criteria and any

Awes.io 160 Dec 26, 2022
A nice GUI for Laravel Artisan, ready out of the box, configurable and handy for non-CLI experienced developers.

Artisan UI A nice GUI for Laravel Artisan, ready out of the box, configurable and handy for non-CLI experienced developers. Supported commands must be

Pablo Leone 1 Dec 3, 2021
🚀 Zero-downtime deployment out-of-the-box

?? Laravel Deployer Looking for the old Laravel Deployer? Click here. Laravel Deployer is no longer the package it used to be. Since that package was

Loris Leiva 1.6k Dec 31, 2022
Library that offers Input Filtering based on Annotations for use with Objects. Check out 2.dev for 2.0 pre-release.

DMS Filter Component This library provides a service that can be used to filter object values based on annotations Install Use composer to add DMS\Fil

Rafael Dohms 89 Nov 28, 2022
Laravel Boilerplate provides a very flexible and extensible way of building your custom Laravel applications.

Laravel Boilerplate Project Laravel Boilerplate provides a very flexible and extensible way of building your custom Laravel applications. Table of Con

Labs64 848 Dec 28, 2022
Laravel Responder - a package for building API responses, integrating Fractal into Laravel and Lumen

A Laravel Fractal package for building API responses, giving you the power of Fractal with Laravel's elegancy.

Alexander Tømmerås 776 Dec 25, 2022
Setting up the a docker + building a simple project on Mac-book using laravel sail

Sailing on mac-book Setting up the a docker + building a simple project on Mac-book with Laravel sail Installing Docker Well, installing docker is the

AmirH.Najafizadeh 3 Jul 31, 2022
An open-source Laravel library for building high-quality, accessible applications and administration dashboards.

Arpite An open-source Laravel library for building high-quality, accessible applications and administration dashboards. Built using Inertia.js, React,

Arpite 3 Jul 5, 2022
Laravel Form builder for version 5+!

Laravel 5 form builder Form builder for Laravel 5 inspired by Symfony's form builder. With help of Laravels FormBuilder class creates forms that can b

Kristijan Husak 1.7k Dec 31, 2022
Razorpay payment gateway integration in laravel with submit form and storing details in payment table.

Integrating razorpay payment gateway in laravel with submit form and storing payment details in payment table. How to settup the project in your local

Mohammed-Thamnees 3 Apr 15, 2021
Laravel Livewire form component with declarative Bootstrap 5 fields and buttons.

Laravel Livewire Forms Laravel Livewire form component with declarative Bootstrap 5 fields and buttons. Requirements Bootstrap 5 Installation composer

null 49 Oct 29, 2022