PHPackages                             krowinski/laravel-xslt - 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. [Templating &amp; Views](/categories/templating)
4. /
5. krowinski/laravel-xslt

ActiveLibrary[Templating &amp; Views](/categories/templating)

krowinski/laravel-xslt
======================

xslt template engine for laravel

3.0.0(8y ago)149752MITPHPPHP &gt;=7.0

Since Jul 15Pushed 6y ago2 watchersCompare

[ Source](https://github.com/krowinski/laravel-xslt)[ Packagist](https://packagist.org/packages/krowinski/laravel-xslt)[ RSS](/packages/krowinski-laravel-xslt/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (5)Versions (6)Used By (0)

laravel-xslt
============

[](#laravel-xslt)

[![Latest Stable Version](https://camo.githubusercontent.com/78a77dc3a4889e8a793dffe1dbb9695b9a53c686e22bef49e676707c0d8d165a/68747470733a2f2f706f7365722e707567782e6f72672f6b726f77696e736b692f6c61726176656c2d78736c742f762f737461626c65)](https://packagist.org/packages/krowinski/laravel-xslt) [![Total Downloads](https://camo.githubusercontent.com/a15d5e8aeb9023432a52ec269fe02d7a04fae2a4a4fec45b69a522f7daff48da/68747470733a2f2f706f7365722e707567782e6f72672f6b726f77696e736b692f6c61726176656c2d78736c742f646f776e6c6f616473)](https://packagist.org/packages/krowinski/laravel-xslt) [![Latest Unstable Version](https://camo.githubusercontent.com/426534c0e2033b90e8f35af645fe519fa9b7ea42d430f1bd1bedb7ea55816674/68747470733a2f2f706f7365722e707567782e6f72672f6b726f77696e736b692f6c61726176656c2d78736c742f762f756e737461626c65)](https://packagist.org/packages/krowinski/laravel-xslt) [![License](https://camo.githubusercontent.com/aedd237c9282fbeb82fb0395d4cb3fb0b9f0e0f41f4bbd542c17534294c56f34/68747470733a2f2f706f7365722e707567782e6f72672f6b726f77696e736b692f6c61726176656c2d78736c742f6c6963656e7365)](https://packagist.org/packages/krowinski/laravel-xslt)

XSLT template engine for laravel

Instalation
===========

[](#instalation)

1. Install using composer in your laravel project

```
composer require krowinski/laravel-xslt
```

2. Add this line to app.php at the end of 'providers' array (in file config/app.php)

```
Krowinski\LaravelXSLT\XSLTServiceProvider::class,
```

3. Create welcome.xsl in resources/views

```

            Laravel

                html, body {
                height: 100%;
                }

                body {
                margin: 0;
                padding: 0;
                width: 100%;
                display: table;
                font-weight: 100;
                font-family: 'Lato';
                }

                .container {
                text-align: center;
                display: table-cell;
                vertical-align: middle;
                }

                .content {
                text-align: center;
                display: inline-block;
                }

                .title {
                font-size: 96px;
                }

                    Laravel 5 XSLT engine template

```

4. Add data to xml using simple xml functions

```
/**
 * Show the application welcome screen to the user.
 *
 * @return Response
 */
public function index()
{
	// adds to main xml /App attributte name template with value  = hello
	\View::addAttribute('name_template ', 'hello');
	// create child template to /App with value hello and add aaa and zzz atribute to template.
	\View::addChild('template', 'hello', false)->addAttribute('aaaa', 'zzz');
	// creates parent example and adds childs foo and bar to it
	\View::addArrayToXmlByChild(['foo', 'bar'], 'example', false);
	// add to parent App child bar and zzz
	\View::addArrayToXml(['bar', 'zzz'], false);

	return view('welcome');
}
```

Add xml to debugBar ()
====================================================================

[](#add-xml-to-debugbar-httpsgithubcombarryvdhlaravel-debugbar)

Add to EventServiceProvider.php

```
use Krowinski\LaravelXSLT\Engines\XSLTEngine;
```

and to protected $listen array

```
XSLTEngine::EVENT_NAME => [
    'App\Listeners\XSLTDebugBar'
],
```

create file Listeners\\XSLTDebugBar.php

```
php artisan make:listener XSLTDebugBar --event XSLTEngineEvent
```

event content

```
