{"id":16085727,"url":"https://github.com/infinitypaul/laravel-multistep-forms","last_synced_at":"2025-04-05T13:42:20.085Z","repository":{"id":56991127,"uuid":"273773727","full_name":"infinitypaul/laravel-multistep-forms","owner":"infinitypaul","description":null,"archived":false,"fork":false,"pushed_at":"2020-07-27T14:21:40.000Z","size":35,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-11T09:50:03.154Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/infinitypaul.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-06-20T19:43:39.000Z","updated_at":"2020-08-10T04:25:51.000Z","dependencies_parsed_at":"2022-08-21T12:20:25.263Z","dependency_job_id":null,"html_url":"https://github.com/infinitypaul/laravel-multistep-forms","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/infinitypaul%2Flaravel-multistep-forms","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/infinitypaul%2Flaravel-multistep-forms/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/infinitypaul%2Flaravel-multistep-forms/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/infinitypaul%2Flaravel-multistep-forms/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/infinitypaul","download_url":"https://codeload.github.com/infinitypaul/laravel-multistep-forms/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247345713,"owners_count":20924098,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-09T13:09:09.822Z","updated_at":"2025-04-05T13:42:20.063Z","avatar_url":"https://github.com/infinitypaul.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Laravel Multi-step Form\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/infinitypaul/laravel-multistep-forms.svg?style=flat-square)](https://packagist.org/packages/infinitypaul/laravel-multistep-forms)\n[![Build Status](https://img.shields.io/travis/infinitypaul/laravel-multistep-forms/master.svg?style=flat-square)](https://travis-ci.org/infinitypaul/laravel-multistep-forms)\n[![Quality Score](https://img.shields.io/scrutinizer/g/infinitypaul/laravel-multistep-forms.svg?style=flat-square)](https://scrutinizer-ci.com/g/infinitypaul/laravel-multistep-forms)\n[![Total Downloads](https://img.shields.io/packagist/dt/infinitypaul/laravel-multistep-forms.svg?style=flat-square)](https://packagist.org/packages/infinitypaul/laravel-multistep-forms)\n\nHi Fellas! So you know how you would like to create a dynamic registration form but then you can't because you feel this is impossible with PHP.\n\nWell, I have good news for ya, this is so POSSIBLE with this package. Yeah that's right, I mean it. Let's get down on the \"how\":\n\nSo we will be working with a 3 step form:\n\n## Installation\n\nYou can install the package via composer:\n\n```bash\ncomposer require infinitypaul/laravel-multistep-forms\n```\n\n## Usage\nAfter installing the package, I will be creating 3 blades for the different steps of the form:\n\n#### Step 1: Create the blades for the form.\n1.blade.php\n``` php\n\u003clink rel=\"stylesheet\" href=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css\" integrity=\"sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u\" crossorigin=\"anonymous\"\u003e\n    \u003cscript src=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js\" integrity=\"sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa\" crossorigin=\"anonymous\"\u003e\u003c/script\u003e\n\n    @extends('layouts.app')\n\n    @section('content')\n\n        \u003cdiv class=\"container\"\u003e\n            \u003cdiv class=\"row justify-content-center\"\u003e\n                \u003cdiv class=\"col-md-8\"\u003e\n                    \u003cdiv class=\"card\"\u003e\n                        \u003cdiv class=\"card-header\"\u003e{{ __('Register') }} \u003c/div\u003e\n                        \u003cdiv class=\"card-body\"\u003e\n\n                            \u003cform method=\"POST\" action=\"{{ route('auth.register.1.store') }}\"\u003e\n                                @csrf\n\n                                \u003cdiv class=\"form-group row\"\u003e\n                                    \u003clabel for=\"name\" class=\"col-md-4 col-form-label text-md-right\"\u003e{{ __('Name') }}\u003c/label\u003e\n\n                                    \u003cdiv class=\"col-md-6\"\u003e\n                                        \u003cinput id=\"name\" type=\"text\" class=\"form-control @error('name') is-invalid @enderror\" name=\"name\" value=\"{{ old('name') ?: $step-\u003ename }}\" required autocomplete=\"name\" autofocus\u003e\n\n                                        @error('name')\n                                        \u003cspan class=\"invalid-feedback\" role=\"alert\"\u003e\n                                            \u003cstrong\u003e{{ $message }}\u003c/strong\u003e\n                                        \u003c/span\u003e\n                                        @enderror\n                                    \u003c/div\u003e\n\n\n                                \u003c/div\u003e\n\n                                \u003cdiv class=\"form-group row\"\u003e\n                                    \u003clabel for=\"middle\" class=\"col-md-4 col-form-label text-md-right\"\u003e{{ __('Middle Name') }}\u003c/label\u003e\n                                    \u003cdiv class=\"col-md-6\"\u003e\n                                        \u003cinput id=\"text\" type=\"text\" class=\"form-control @error('middle') is-invalid @enderror\" name=\"middle\" value=\"{{ old('middle') ?: $step-\u003emiddle }}\" required autocomplete=\"email\" autofocus\u003e\n\n                                        @error('middle')\n                                        \u003cspan class=\"invalid-feedback\" role=\"alert\"\u003e\n                                            \u003cstrong\u003e{{ $message }}\u003c/strong\u003e\n                                        \u003c/span\u003e\n                                        @enderror\n                                    \u003c/div\u003e\n                                \u003c/div\u003e\n\n                                \u003cdiv class=\"form-group row mb-0\"\u003e\n                                    \u003cdiv class=\"col-md-6 offset-md-4\"\u003e\n                                        \u003cbutton type=\"submit\" class=\"btn btn-primary\"\u003e\n                                            {{ __('Next') }}\n                                        \u003c/button\u003e\n                                    \u003c/div\u003e\n                                \u003c/div\u003e\n                            \u003c/form\u003e\n                        \u003c/div\u003e\n                    \u003c/div\u003e\n                \u003c/div\u003e\n            \u003c/div\u003e\n        \u003c/div\u003e\n\n    @endsection\n\n```\n\n\n2.blade.php\n``` php\n\u003clink rel=\"stylesheet\" href=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css\" integrity=\"sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u\" crossorigin=\"anonymous\"\u003e\n\u003cscript src=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js\" integrity=\"sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa\" crossorigin=\"anonymous\"\u003e\u003c/script\u003e\n\n@extends('layouts.app')\n\n@section('content')\n    \u003cdiv class=\"container\"\u003e\n        \u003cdiv class=\"row justify-content-center\"\u003e\n            \u003cdiv class=\"col-md-8\"\u003e\n                \u003cdiv class=\"card\"\u003e\n                    \u003cdiv class=\"card-header\"\u003e{{ __('Register') }}\u003c/div\u003e\n\n                    \u003cdiv class=\"card-body\"\u003e\n                        \u003cform method=\"POST\" action=\"{{ route('auth.register.2.store') }}\"\u003e\n                            @csrf\n\n                            \u003cdiv class=\"form-group row\"\u003e\n                                \u003clabel for=\"email\" class=\"col-md-4 col-form-label text-md-right\"\u003e{{ __('E-Mail Address') }}\u003c/label\u003e\n\n                                \u003cdiv class=\"col-md-6\"\u003e\n                                    \u003cinput id=\"email\" type=\"email\" class=\"form-control @error('email') is-invalid @enderror\" name=\"email\" value=\"{{ old('email') ?: $step-\u003eemail }}\" required autocomplete=\"email\"\u003e\n\n                                    @error('email')\n                                    \u003cspan class=\"invalid-feedback\" role=\"alert\"\u003e\n                                        \u003cstrong\u003e{{ $message }}\u003c/strong\u003e\n                                    \u003c/span\u003e\n                                    @enderror\n                                \u003c/div\u003e\n                            \u003c/div\u003e\n\n                            \u003cdiv class=\"form-group row mb-0\"\u003e\n                                \u003cdiv class=\"col-md-6 offset-md-4\"\u003e\n                                    \u003cbutton type=\"submit\" class=\"btn btn-primary\"\u003e\n                                        {{ __('Next') }}\n                                    \u003c/button\u003e\n                                \u003c/div\u003e\n                            \u003c/div\u003e\n                        \u003c/form\u003e\n                    \u003c/div\u003e\n                \u003c/div\u003e\n            \u003c/div\u003e\n        \u003c/div\u003e\n    \u003c/div\u003e\n@endsection\n\n```\n\n3.blade.php\n``` php\n\u003clink rel=\"stylesheet\" href=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css\" integrity=\"sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u\" crossorigin=\"anonymous\"\u003e\n\u003cscript src=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js\" integrity=\"sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa\" crossorigin=\"anonymous\"\u003e\u003c/script\u003e\n\n@extends('layouts.app')\n\n@section('content')\n    \u003cdiv class=\"container\"\u003e\n        \u003cdiv class=\"row justify-content-center\"\u003e\n            \u003cdiv class=\"col-md-8\"\u003e\n                \u003cdiv class=\"card\"\u003e\n                    \u003cdiv class=\"card-header\"\u003e{{ __('Register') }}\u003c/div\u003e\n\n                    \u003cdiv class=\"card-body\"\u003e\n                        \u003cform method=\"POST\" action=\"{{ route('auth.register.3.store') }}\"\u003e\n                            @csrf\n\n\n                            \u003cdiv class=\"form-group row\"\u003e\n                                \u003clabel for=\"password\" class=\"col-md-4 col-form-label text-md-right\"\u003e{{ __('Password') }}\u003c/label\u003e\n\n                                \u003cdiv class=\"col-md-6\"\u003e\n                                    \u003cinput id=\"password\" type=\"password\" class=\"form-control @error('password') is-invalid @enderror\" name=\"password\" required autocomplete=\"new-password\"\u003e\n\n                                    @error('password')\n                                    \u003cspan class=\"invalid-feedback\" role=\"alert\"\u003e\n                                        \u003cstrong\u003e{{ $message }}\u003c/strong\u003e\n                                    \u003c/span\u003e\n                                    @enderror\n                                \u003c/div\u003e\n                            \u003c/div\u003e\n\n                            \u003cdiv class=\"form-group row mb-0\"\u003e\n                                \u003cdiv class=\"col-md-6 offset-md-4\"\u003e\n                                    \u003cbutton type=\"submit\" class=\"btn btn-primary\"\u003e\n                                        {{ __('Finish') }}\n                                    \u003c/button\u003e\n                                \u003c/div\u003e\n                            \u003c/div\u003e\n                        \u003c/form\u003e\n                    \u003c/div\u003e\n                \u003c/div\u003e\n            \u003c/div\u003e\n        \u003c/div\u003e\n    \u003c/div\u003e\n@endsection\n\n```\n#### Step 2: Create the controller for the each form.\n\nAfter creating the blade views for each of the forms, p.s: I created them in a folder \"register\". We'll be heading to the controller, so in app\\Http\\Controllers\\Auth, we would be creating a folder \"Register\" i.e our path will be \"app\\Http\\Controllers\\Auth\\Register\". In the Register folder, we would be creating 3 controllers for the three steps:\n\nRegisterControllerStep1.php\n``` php\n\u003c?php\n\nnamespace App\\Http\\Controllers\\Auth\\Register;\n\nuse App\\Http\\Controllers\\Controller;\nuse Illuminate\\Http\\Request;\nuse Illuminate\\Support\\Facades\\Storage;\nuse Infinitypaul\\MultiStep\\MultiStep;\n\n\nclass RegisterControllerStep1 extends Controller\n{\n    public function index(){\n\n        $step  =MultiStep::step('auth.register', 1);\n        return view('auth.register.1', compact('step'));\n    }\n\n    public function store(Request $request){\n        MultiStep::step('auth.register', 1)-\u003estore(['name' =\u003e $request-\u003ename, 'middle' =\u003e $request-\u003emiddle])-\u003ecomplete();\n        return redirect()-\u003eroute('auth.register.2.index');\n    }\n}\n\n```\n\nRegisterControllerStep2.php\n``` php\n\u003c?php\n\nnamespace App\\Http\\Controllers\\Auth\\Register;\n\nuse App\\Http\\Controllers\\Controller;\nuse Illuminate\\Http\\Request;\nuse Infinitypaul\\MultiStep\\MultiStep;\n\nclass RegisterControllerStep2 extends Controller\n{\n    public function index(){\n        $step  =MultiStep::step('auth.register', 2);\n        return view('auth.register.2', compact('step'));\n    }\n\n\n    public function store(Request $request){\n        MultiStep::step('auth.register', 2)-\u003estore($request-\u003eonly('email'))-\u003ecomplete();\n\n        return redirect()-\u003eroute('auth.register.3.index');\n    }\n}\n\n```\nRegisterControllerStep3.php\n\n``` php\n\u003c?php\n\nnamespace App\\Http\\Controllers\\Auth\\Register;\n\nuse App\\Http\\Controllers\\Controller;\nuse Illuminate\\Http\\Request;\nuse Infinitypaul\\MultiStep\\MultiStep;\n\n\nclass RegisterControllerStep3 extends Controller\n{\n    public function index(){\n        $step = MultiStep::step('auth.register', 3);\n        if($step-\u003enotCompleted(1)){\n            return redirect()-\u003eroute('auth.register.1.index');\n        }\n        return view('auth.register.3');\n    }\n\n    public function store(MultiStep $multiStep, Request $request){\n        MultiStep::step('auth.register', 3)-\u003estore($request-\u003eonly('password'))-\u003ecomplete();\n\n        MultiStep::clearAll();\n    }\n}\n\n```\n#### Step 3: Routing!\n\nLet's move on to the route, in our web.php, we will include this:\n``` php\nRoute::multistep('auth/register', 'Auth\\Register\\RegisterController')\n    -\u003esteps('3')\n    -\u003ename('auth.register')\n    -\u003eonly(['index', 'store']);\n```\n\nWe're done guys!!!\n\nSo if I head to {URL}/auth/register/1, I would see this:\n![Form 1](https://github.com/Vheekey/testing-readme/blob/master/Screenshot_2020-07-08%20Laravel.png)\n\nWhen I click on next, it takes me to {URL}/auth/register/2 and this will display:\n![Form 2](https://github.com/Vheekey/testing-readme/blob/master/Screenshot_2020-07-08%20Laravel(1).png)\n\nOn clicking on next, we get {URL}/auth/register/3:\n![Form 3](https://github.com/Vheekey/testing-readme/blob/master/Screenshot_2020-07-08%20Laravel(2).png)\n\nIts a wrap! Well done guys!!!\n\n### Testing\n\n``` bash\ncomposer test\n```\n\n### Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.\n\n## Contributing\n\nPlease see [CONTRIBUTING](CONTRIBUTING.md) for details.\n\n## Bugs \u0026 Fixtures\nIf you have spotted any bugs, or would like to request additional features from the library, please file an issue via the Issue Tracker on the project's Github page: https://github.com/infinitypaul/laravel-multistep-forms/issues.\n\n\n### Security\n\nIf you discover any security related issues, please email infinitypaul@live.com instead of using the issue tracker.\n\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finfinitypaul%2Flaravel-multistep-forms","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finfinitypaul%2Flaravel-multistep-forms","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finfinitypaul%2Flaravel-multistep-forms/lists"}