Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/geggleto/form-builder
No depending Object Oriented Form builder
https://github.com/geggleto/form-builder
Last synced: 5 days ago
JSON representation
No depending Object Oriented Form builder
- Host: GitHub
- URL: https://github.com/geggleto/form-builder
- Owner: geggleto
- License: mit
- Created: 2016-08-03T14:41:30.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-03-09T21:45:26.000Z (over 7 years ago)
- Last Synced: 2023-08-16T22:17:01.597Z (over 1 year ago)
- Language: PHP
- Size: 38.1 KB
- Stars: 5
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Html Form Builder
Make HTML Forms, Easy.
## Factories
- Bootstrap 3
But if you want to use something else feel free to build and PR it.## Why?
Decouple your UI from flavour of the month CSS frameworks.
## How?
Have a new favourite CSS framework? Write your own Factory!
### Csv Parser
```php
$builder = new Builder(new Factory()); //default is Bootstrap 3
$root = $builder->build((new CsvParser())->parseSchemaCsvToArray("form.csv"), "Login");
$builder->write($rootElement, './userLoginForm.php');
```### Json Parser
```php
$builder = new Builder(new Factory()); //default is Bootstrap 3
$root = $builder->build((new JsonParser())->parseSchemaCsvToArray("form.json"), "Login");
$builder->write($rootElement, './userLoginForm.php');
```### Procedural
```php
$builder = new Builder(new Factory()); //default is Bootstrap 3$schema = [];
$schema[] = $builder->getSchemaForColumn('username')
->setPlaceholder('Username');
->setType('text');$schema[] = $builder->getSchemaForColumn('password')
->setPlaceholder('Password');
->setType('password');$schema[] = $builder->getSchemaForColumn('domain')
->setPlaceholder('Password');
->setType('select')
->setOptions([
"example.com" => 1,
"beta.example.com" => 2,
"theta.example.com" => 3,
]);$rootElement = $builder->build($schema, 'Login');
$builder->write($rootElement, './userLoginForm.php');
```