Download the PHP package 64robots/webforms without Composer
On this page you can find all versions of the php package 64robots/webforms. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download 64robots/webforms
More information about 64robots/webforms
Files in 64robots/webforms
Package webforms
Short Description Backend for 64 Robots webforms.
License MIT
Homepage https://github.com/64robots/webforms
Informations about the package webforms
Backend for 64 Robots webforms
Package to rapidly create custom forms. This package provides you an easy way to start the backend for an SPA Form. You could create forms, form steps and questions. Your users could respond to these forms. Made by 64 Robots.
Installation
You can install the package via composer:
You can publish and run the migrations with:
You can publish the config file with:
This is the contents of the published webforms.php config file:
Usage
1 - Add Routes
At the moment, the package doesn't work with anonymous users. Please, add that to your routes file under an auth middleware:
If you want routes to create Forms, FormSteps and Questions, add that under the appropriate middleware in your routes file:
2 - Add HasWebForms trait in your user entity.
3 - Create Seeders for Form, FormSteps and Question.
Example
Let's start a new form to collect info about coffee in your app:
We will add in routes/api.php:
We will also add in routes/api_admin.php:
The next step is to add a new Form. Just create a new Seeder.
Now in the Seeder file database/seeders/CoffeeSeeder we'll include the creation of the form, form steps and questions.
Let's start with the form creation:
Once we have the form we'll need to add, at least, a form step:
Then we can add questions to this step:
Add now a new step to collect some personal info. We'll encrypt that info in the database:
Then add the questions:
Once we have that, we can add the questions steps to users:
If we want to add all the formSteps to the users we can also use:
When the users ask for the forms they will get only the forms they had steps on it. We need to do an authenticated request to:
/webforms/forms
We'll get something like:
Let's say the form is the one with id 1. Then we can make another one to:
/webforms/form-steps?form=1
We'll obtain all the forms steps info:
For each form step we need to ask for the questions using:
/webforms/questions?form_step=1
We need to do the same with the personal info step:
/webforms/questions?form_step=2
When a user needs to send an answer to a question, we will need to make a POST request to:
/webforms/answers
With the following payload:
We will receive the question but now with an answer on it:
Testing
Copy phpunit.xml.dist to phpunit.xml
Adapt or change the values in the next portion of code to your preferences:
Create the database, in this case r64_webforms.
Execute:
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Credits
- 64 Robots
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
Acknowledgments
Thanks to Spatie for the Package Skeleton Laravel.
All versions of webforms with dependencies
illuminate/database Version ^7.0|^8.0
illuminate/http Version ^7.0|^8.0
illuminate/queue Version ^7.0|^8.0
illuminate/support Version ^7.0|^8.0
illuminate/validation Version ^7.0|^8.0
php Version ^7.4