PHPackages                             administrcms/form - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. administrcms/form

ActiveLibrary

administrcms/form
=================

Form package for the administrcms as good as standalone laravel package

0.1.44(9y ago)251513JavaScriptPHP &gt;=5.5.9CI failing

Since Oct 27Pushed 5y ago1 watchersCompare

[ Source](https://github.com/administrcms/form)[ Packagist](https://packagist.org/packages/administrcms/form)[ RSS](/packages/administrcms-form/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (10)Dependencies (6)Versions (16)Used By (3)

Form Builder for the Administr package
======================================

[](#form-builder-for-the-administr-package)

[![Build Status](https://camo.githubusercontent.com/c882e7cfd46b267bb0deea51660721a4f83581fbda048ae7caa99d3f74f2d921/68747470733a2f2f7472617669732d63692e6f72672f61646d696e69737472636d732f666f726d2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/administrcms/form)[![Code Climate](https://camo.githubusercontent.com/87690e0103c3eae5d90135966cff9b4142d58acc6d5eebee4b506a5d20492094/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f61646d696e69737472636d732f666f726d2f6261646765732f6770612e737667)](https://codeclimate.com/github/administrcms/form)[![Test Coverage](https://camo.githubusercontent.com/e5fa6c25a128d313b2ef8c9a1702dcc98aa6997137a495599b172f3ff7b64aa3/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f61646d696e69737472636d732f666f726d2f6261646765732f636f7665726167652e737667)](https://codeclimate.com/github/administrcms/form/coverage)

Work-in-progress.

Installation
============

[](#installation)

- Install using composer:

```
composer require administrcms/form

```

- Register the Service Provider (in config/app.php or in app/Providers/AppServiceProvider.php):

```
// in app.php
'providers' => [
    // ...
    Administr\Form\FormServiceProvider::class,
    // ...
],

// in AppServiceProvider
public function register()
{
    $this->app->register(\Administr\Form\FormServiceProvider::class);
}
```

- Publish assets, configs, migrations and etc.

```
php artisan vendor:publish --provider="Administr\Form\FormServiceProvider"

```

Creating forms
==============

[](#creating-forms)

There is a command available, which will generate a basic scaffold of a Form class for you.

`php artisan administr:form MyForm`

Or you can just create a new class which extends the `Administr\Form\Form` class and implement the two abstract methods - rules and form.

Form look and feel
==================

[](#form-look-and-feel)

By default the form fields are just basic html, without any styling. When you publish the assets which are connected to the package, the views will be exported to `resources/views/vendor/administrcms/form`, where you can modify them to adopt the theme of your application.

Usage
=====

[](#usage)

The form class needs to be resolved through the IoC container. One way to do that is to type hint the class in the method name.

The forms works like the FormRequests in Laravel, meaning that when you have type hinted the form in the method which responds to the post/put action, it will validate the form and if it is successful then it will execute the code in the method. Otherwise it will return the user back with the errors and populate the form with the user input and display the errors.

```
