Installation - laraplus/form GitHub Wiki

To install the Laraplus form package, simply require it through composer:

composer require laraplus/form

Laravel integration

If you are using Laravel, this package provides a service provider for easy integration. You can add it in your app.php configuration file:

'providers' => [
   // ...
   Laraplus\Form\FormServiceProvider,
]

If you wish to build forms directly in your views, you need to register the Form facade as well:

'aliases' => [
    // ...
    Laraplus\Form\Facades\Form.php,
]

To override the package's configuration, you need to copy the configuration file into your project. You can do that by running:

php artisan vendor:publish --provider="Laraplus\Form\FormServiceProvider" --tag="config"

A form.php configuration file will be created in your config directory, which you can edit freely.

Integration with other PHP projects

If you are not using Laravel, then you need to initialize the form builder manually. Don't worry, it's an easy process - just follow the procedure below:

use Laraplus\Form\DataStores\PhpDataStore;
use Laraplus\Form\Presenters\Bootstrap3Presenter;
use Laraplus\Form\ConfigProviders\PhpConfigProvider;

$presenter = new Bootstrap3Presenter();
$dataStore = new PhpDataStore();
$configProvider = new PhpConfigProvider([
    // enter your configuration here
]);

$form = new Form($presenter, $dataStore, $configProvider);

Now you can access all of the functionality through the $form variable.