|
3 | 3 | [](LICENSE.md) |
4 | 4 | [](https://travis-ci.org/webstractions/sage-xpress) |
5 | 5 |
|
6 | | -A collection of extensions for your Roots\Sage 9.x beta themes. |
| 6 | +A collection of extensions, providers, and Blade revisions for your Roots\Sage 9.x beta themes. |
7 | 7 |
|
8 | 8 | - **Blade Directives:** @directives for loop, query, sidebar, FontAwesome, and more. |
9 | 9 | - **Menu Provider:** Register nav menu and markup via configuration file. |
10 | 10 | - **Sidebar Provider:** Register sidebar and widget markup via configuration file. |
11 | 11 | - **Comment Form Provider:** Register comment form markup via configuration file. |
12 | 12 | - **Schema Provider** Quickly add schema.org markup via @schema directive. |
| 13 | +- **Facade/Alias Support** Provide a "static" interface to classes that are bound to the Sage container. |
| 14 | +- **Blade Fixes** Fixes Blade `@inject` directive and 5.5's `Blade::if()` method. |
13 | 15 |
|
14 | 16 | ## Requirements |
15 | 17 | This package is specifically built for `Roots\Sage 9.0.0-beta.4` and above. It goes without saying that your development server needs to have `Php 7.0` or greater as well. |
@@ -67,6 +69,25 @@ Outside of one line of code that you need to add to `setup.php` and the config f |
67 | 69 |
|
68 | 70 | Additionally, your `setup.php` file should actually be leaner. No need for `widgets_init`, `register_nav_menus`, and funky `wp_nav_menu` callouts in your controllers or blade files. The providers automatically do the registration for you based on your configurations and there are Blade Directives to spew them out. |
69 | 71 |
|
| 72 | +## Facades and Aliases |
| 73 | +You can now register `aliases` via the `config\app.php` configuration file. Currently, there are standard Laravel Facades for Blade, Config, Event, File, and View. Facades for SageXpress providers are in a state of flux and currently supports Comments, Menu, and Sidebar. |
| 74 | + |
| 75 | +With Facades, you can reference bound providers with unruly instantiation and method calls like the following. |
| 76 | + |
| 77 | +Instead of |
| 78 | +```php |
| 79 | +sage('blade')->compiler()->directive('name', function ($expression) { |
| 80 | + // Handle the directive. |
| 81 | + }); |
| 82 | +``` |
| 83 | +You can: |
| 84 | +```php |
| 85 | +Blade::directive('name', function ($expression) { |
| 86 | + // Handle the directive. |
| 87 | + }); |
| 88 | +``` |
| 89 | +Facades have some advantages. Rather than list the pros and cons of Facades, and how they work, please reference the [Laravel Facade Documentation](https://laravel.com/docs/5.4/facades). |
| 90 | + |
70 | 91 | ## The SageXpress Provider |
71 | 92 | SageXpress providers are similar to Laravel Service Providers, but they contain additional methods for `config()` and `render()`. You can think of them as configurable components that can be rendered in a Blade view. |
72 | 93 |
|
|
0 commit comments