baileyparker / laravel-betterhtml by parker

A better HtmlBuilder for Laravel 4 (including support for raw, non-escaped HTML and more tags)
6
0
3
Package Data
Maintainer Username: parker
Maintainer Contact: b@ileyparker.com (Bailey Parker)
Package Create Date: 2014-06-20
Package Last Update: 2014-09-11
Language: PHP
License: MIT
Last Refreshed: 2024-11-25 15:03:06
Package Statistics
Total Downloads: 6
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 0
Total Watchers: 3
Total Forks: 0
Total Open Issues: 1

A Better HtmlBuilder for Laravel 4

An expanded, backwards compatible HtmlBuilder for Laravel 4 which features raw HTML (and nesting builder methods), methods for all HTML5 tags, convenience functions for common tasks like creating <meta name="description"> tags, and simple wrapping capabilities.

Usage

{{ Html::div(Html::linkAction('HomeController@index', 'Back to Home'), ['class' => 'home-link']) }}

{{ Html::nav(Html::ul([

    Html::linkAction('HomeController@index', 'Home'),
    Html::linkAction('AboutUsController@index', 'About Us'),
    Html::linkAction('BlogController@index', 'Blog'),
    Html::linkAction('ContactController@form', 'Contact Us'),

], ['class' => 'navigation-list'])) }}

Installation

First, add the following line to "require" in your composer.json:

"parker/laravel-betterhtml": "~0.1"

Next, run composer update from the command line. After that, need to replace the following service provider in your app.php config file (feel free to comment it out):

'Illuminate\Html\HtmlServiceProvider',

with this:

'Parker\BetterHtml\Html\HtmlServiceProvider',

To be able to access Better HtmlBuilder with the HTML facade, you need to replace the following alias in your app.php config file (feel free to comment it out):

'HTML' => 'Illuminate\Support\Facades\HTML',

with this:

'HTML' => 'Parker\BetterHtml\Support\Facades\HTML',

Additionally, because of the way that Laravel's e() helper is defined and used (see laravel/framework PR #4783), you also need to include BetterHtml's custom e() helper in your app/start/global.php:

/*
|--------------------------------------------------------------------------
| Load the Better HtmlBuilder helpers
|--------------------------------------------------------------------------
|
| Here we load helpers for the Better HtmlBuilder so that they can
| override ones provided by laravel in Illuminate\Support\helpers.php.
|
*/

$betterHtmlVendor = $app['path.base'] . '/vendor/parker/laravel-betterhtml';

require $betterHtmlVendor . '/src/Parker/BetterHtml/Support/helpers.php';

Contributing

Do you know a way that we can make Laravel's HtmlBuilder even better? Please submit your ideas in the form of an issue on this repository with your proposal and a sample use case. Bug pull requests are greatly appreciated (but reports are fine too if you can't track down the cause yourself).

Requirements

  • PHP >= 5.4.0
  • Laravel 4.2

License

BetterHtmlBuilder for Laravel 4 is open-sourced software licensed under the MIT License.