Download the PHP package ycs77/laravel-wizard without Composer

On this page you can find all versions of the php package ycs77/laravel-wizard. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-wizard

Laravel Wizard

Latest Version on Packagist GitHub Tests Action Status Style CI Build Status Total Downloads

A web setup wizard for Laravel application.

This package is adapted from smajti1/laravel-wizard.

Table of Contents

Version Compatibility

Laravel Wizard Laravel PHP
1.0.x 5.5 ^7.0
1.1.x ^5.6 ^7.1.3
2.0.x,2.1.x ^5.6 | ^6.x ^7.1.3
2.2.x ^5.6 | ^6.x | ^7.x ^7.1.3
2.3.x >=5.6 | <=9.0 >=7.1.3 | <=8.2
3.x >=9.0 >=8.1
4.x >=11.0 >=8.2

Installation

Install the package via composer:

Publish config:

Usage

1. Generate controller and wizard steps

Now you can qckly generate the wizard controller and the wizard steps:

This command generates the UserWizardController, NameStep, and EmailStep class, and appends the wizard route to routes/web.php.

routes/web.php

If you can't use auto append route, you can set config/wizard.php attribute append_route to false.

2. Set steps

This is generated NameStep class, you can to model method set the model, to rules method set form validation, and save $data to your database via the saveData method, for example:

app/Steps/User/NameStep.php

And add some steps view, for example:

resources/views/steps/user/name.blade.php

resources/views/steps/user/email.blade.php

Next, browse the URL /wizard/user, and start to use the Laravel Wizard.

If you want to get the layout you can copy Laravel layouts/app.blade.php to resources/views/layouts/app.blade.php

3. Install wizard steps CSS package

The CSS for this package default view is based on the Bootstrap Steps, use NPM installation to use:

Import to the app.scss file and run npm run dev or yarn run dev:

resources/sass/app.scss

Cache

Database Driver

To use the database wizard cache driver, you will need a database table to hold the cache data of the wizard. Generate a migration that creates this table, and runs the wizard:table Artisan command:

Disable Cache

Set cache in config/wizard.php to false to disable cache input data:

Or set it to your WizardController wizardOptions property:

If disabled cache, the data will be saved in the data immediately after each step is sent. If you are afraid to save the data repeatedly, you can hide the Prev button, or use Model::updateOrCreate() (https://laravel.com/docs/6.x/eloquent#other-creation-methods).

Controller

Setting Configuration

Add wizardOptions property to your wizard controller, you can use the cache, driver, connection, and table options to override configuration.

app/Http/Controllers/UserWizardController.php

Customize View

This package layout view uses Bootstrap 5, but if you don't want to use default views, you can publish views to custom it:

If you used Bootstrap 4, you could publish the layouts:

If you used Tailwind CSS, you could publish the layouts:

Now you can customize resources/views/vendor/wizard/*.blade.php in your Laravel project.

But if you want a custom-only one wizard view base view, you can copy the views from resources/views/vendor/wizard/*.blade.php to resources/views/wizards/user/*.blade.php. (user is wizardName property value on your wizard controller),

Step

Get cached data

For example, FirstStep has name and email fields, and SecondStep has age and phone fields. you can use the data method of step to get step data:

Or you can use the step repository to get other step data:

Redirect to the step

If you want to manually redirect to another step, you can use the redirectToStep() of the wizard, it will return a redirect response.

Step repository

Step repository saves all steps data, if you want to use another step, you need to use it:

From wizard:

From step:

Get the previous step:

Get the next step:

Step repository all can use method detailed reference: src/StepRepository.php

Upload Files

Since v2.3.3 upload files in Cache and No Cache are supported, if use the Cache Mode you can cache all input data and uploaded files to save in the last step:

Then add a step view to upload the avatar image:

resources/views/steps/user/has-avatar.blade.php

Skip step

Note: v2.3.3+

To make Step skippable, set the $skip property to true, then this Step will skip the validation and save data:

app/Steps/User/NameStep.php

Passing data to views

Because each step is injected into the view of the step, so just add the method to return the data in the step class. For example, pass the data of the select options to view:

app/Steps/User/NameStep.php

resources/views/steps/user/name.blade.php

The getOptions method is custom and can be changed at will.

Save data on another step

Suppose there are now two Steps NameStep and EmailStep. First, don't set the Model for all Steps, but don't use the last one:

app/Steps/User/NameStep.php

Next, receive all the data in the last Step and save the Model:

app/Steps/User/EmailStep.php

Set relationships model

Similarly, you can set the relationships model in the model method of the step.

Force restart from first step

If you don't keep the cache on click the start wizard button, you can change the link to /wizard/user?_reset=1.

If you have any custom cache data you want to clean up, you can set the clean up into cleanUpWizard() hook in your WizardController, then it will clean on wizard done or visit route with ?_reset=1 parameter:

app/Http/Controllers/UserWizardController.php

Commands

Make wizard:

The make:wizard command and make:wizard:controller command difference, is make:wizard command will append the route and not confirm generate step.

Make controller:

The make:wizard:controller command only generates the WizardController, NameStep, and EmailStep class.

Make step:

With step label and wizard:

Add custom view path:

Sponsor

If you think this package has helped you, please consider Becoming a sponsor to support my work~ and your avatar will be visible on my major projects.

Become a Patron

Credits

License

MIT LICENSE


All versions of laravel-wizard with dependencies

PHP Build Version
Package Version
Requires php Version >=8.2
laravel/framework Version >=11.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package ycs77/laravel-wizard contains the following files

Loading the files please wait ....