├── .gitignore
├── .idea
├── encodings.xml
├── html5inputs.iml
├── modules.xml
├── scopes
│ └── scope_settings.xml
└── vcs.xml
├── .travis.yml
├── README.md
├── composer.json
├── phpunit.xml
├── src
└── Smalldogs
│ └── Html5inputs
│ ├── Html5InputsFacade.php
│ └── Html5InputsServiceProvider.php
└── tests
└── .gitkeep
/.gitignore:
--------------------------------------------------------------------------------
1 | /vendor
2 | composer.phar
3 | composer.lock
4 | .DS_Store
5 | /.idea
6 |
--------------------------------------------------------------------------------
/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/.idea/html5inputs.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/.idea/scopes/scope_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: php
2 |
3 | php:
4 | - 5.4
5 | - 5.5
6 | - 5.6
7 | - hhvm
8 |
9 | before_script:
10 | - travis_retry composer self-update
11 | - travis_retry composer install --prefer-source --no-interaction --dev
12 |
13 | script: phpunit
14 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | Laravel HTML 5 Inputs
2 | =====================
3 | 
4 | [](http://opensource.org/licenses/BSD-2-Clause)
5 | 
6 | [](https://packagist.org/packages/smalldogs/html5inputs)
7 |
8 | Composer package which adds support for HTML5 elements by extending Laravel's Form interface (e.g. Form::date())
9 |
10 | Adds support for: `color`, `date`, `datetime`, `datatime-local`, `month`, `number`, `range`, `search`, `tel`, `time`, `week`. Laravel
11 | Form interfce supports Email & Url out of the box.
12 |
13 | This package allows you to use HTML5 inputs the same way as normal text fields Form::color('inputName');
14 |
15 | Upgrade From v1
16 | ---------------
17 |
18 | 1. In your `composer.json` file, update the require line for this package to `2.*`
19 |
20 | ```json
21 | "require": {
22 | "smalldogs/html5inputs": "2.*"
23 | },
24 | ```
25 |
26 | 2. In your command line, run `composer update`.
27 |
28 |
29 | 3. Follow Step 2 below.
30 |
31 |
32 |
33 | New Installation
34 | ----------------
35 |
36 | 1. On your command line
37 |
38 | ```bash
39 | composer require "smalldogs/html5inputs:2.*"
40 | ```
41 |
42 | 2. **REPLACE** the form alias with the new, extended facade, in `app/config/app.php`.
43 | ```php
44 | 'aliases' => array(
45 | 'Form' => 'Smalldogs\Html5inputs\Html5InputsFacade',
46 | // 'Form' => 'Illuminate\Support\Facades\Form',
47 | };
48 | ```
49 |
50 | 3. Add the service provider to your `app/config/app.php` providers array
51 | ```php
52 | 'providers' => array(
53 | 'Smalldogs\Html5inputs\Html5InputsServiceProvider',
54 | );
55 | ```
56 |
57 |
58 | How to Use
59 | ----------
60 |
61 | Just like your normal Form interface.
62 |
63 | ```php
64 | // Create a date field
65 | Form::date('yourBirthday');
66 |
67 | // Create a pre-populated month field for June 2014
68 | Form::month('hottestMonth', '2014-06');
69 |
70 | // Create an empty input with bootstrap styles
71 | Form::search('searchBox', null, ['class' => 'form-control']);
72 |
73 | // Auto-associate label with input (use the same name)
74 | Form::label('favoriteColor', 'Select Your Favorite Color');
75 | Form::color('favoriteColor', '#FFAE25');
76 |
77 |
78 | // Use Form-model binding
79 | $user = new User();
80 | $user->phoneNumber = '123-555-5555';
81 | {{ Form::model($user) }}
82 | {{ Form::label('phoneNumber', 'Update Your Phone #') }}
83 | {{ Form::tel('phoneNumber') }}
84 | {{ Form::close() }}
85 | ```
86 |
87 | Changes from v1
88 | ---------------
89 |
90 | The major difference between v1 and v2 is how the Form class is extended. Version 1 made use of the
91 | [Form::macro](http://laravel.com/docs/4.2/html#custom-macros) method, while v2 creates a Facade which extends `\Illuminate\Support\Facades\Form` directly.
92 |
93 | This allows for more direct similarity between the handling of the new methods and the default methods (
94 | such as "text" or "email").
95 |
96 | This also enables [Form Model Binding](http://laravel.com/docs/4.2/html#form-model-binding) with the new HTML5
97 | elements.
98 |
99 |
--------------------------------------------------------------------------------
/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "smalldogs/html5inputs",
3 | "description": "Adds support for all 11 remaining HTML5 elements (Laravel already supports 2 out of the box) using Laravels 4.2 Form interface (e.g. Form::date())",
4 | "license" : "BSD-2-Clause",
5 | "homepage" : "https://blog.smalldo.gs/2014/04/laravel-4-html5-input-elements/",
6 | "time" : "2014-11-20",
7 | "issues" : "https://github.com/smalldogs/html5inputs/issues",
8 | "authors": [
9 | {
10 | "name": "Dustin Brownell",
11 | "email": "dustin@smalldo.gs",
12 | "homepage" : "https://www.smalldo.gs"
13 | }
14 | ],
15 | "keywords" : ["laravel","html5","form", "input","helper","form builder","extend"],
16 | "require": {
17 | "php": ">=5.4.0",
18 | "illuminate/support": "~5.0"
19 | },
20 | "autoload": {
21 | "psr-0": {
22 | "Smalldogs\\Html5inputs": "src/"
23 | }
24 | },
25 | "minimum-stability": "stable"
26 | }
27 |
--------------------------------------------------------------------------------
/phpunit.xml:
--------------------------------------------------------------------------------
1 |
2 |
13 |
14 |
15 | ./tests/
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/src/Smalldogs/Html5inputs/Html5InputsFacade.php:
--------------------------------------------------------------------------------
1 |