krowinski/laravel-xslt
Larablocks Analysis
krowinski/laravel-xslt works with Laravel 5 (latest release 3.0.0, Dec 31, 2017), which reached end of life: no more fixes, even for security.
Recommendation checks
Not advisedNot advised: no release or commit in over 2 years.
- No release or commit in over 2 years
- Supports only Laravel 5, past end of life
- No release in the last 12 months (last: Dec 31, 2017)
- 0 downloads a month (needs 10,000)
- 14 GitHub stars (needs 100)
State
Likely abandoned- No release or commit in over 2 years.
- Last stable release: Dec 31, 2017.
- No releases in the last 12 months.
- First released: Jul 15, 2015.
- 0 open issues on GitHub.
Data from Packagist and GitHub, checked by Larablocks on Dec 4, 2026.
| Install | |
|---|---|
composer require krowinski/laravel-xslt |
|
| Latest Version: | 3.0.0 |
| PHP: | >=7.0 |
| Laravel: | 5 |
| License: | MIT |
| Last Updated: | Dec 20, 2019 |
| Links: | GitHub · Packagist |
laravel-xslt
XSLT template engine for laravel
Instalation
- Install using composer in your laravel project
composer require krowinski/laravel-xslt
- Add this line to app.php at the end of 'providers' array (in file config/app.php)
Krowinski\LaravelXSLT\XSLTServiceProvider::class,
- Create welcome.xsl in resources/views
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exslt="http://exslt.org/common" xmlns:str="http://exslt.org/strings" xmlns:php="http://php.net/xsl" exclude-result-prefixes="exslt str php">
<xsl:output encoding="UTF-8" method="xml" omit-xml-declaration="yes" indent="yes"
doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" cdata-section-elements="script"/>
<xsl:template match="/">
<head>
<title>Laravel</title>
<link href="https://fonts.googleapis.com/css?family=Lato:100" rel="stylesheet" type="text/css"/>
<style>
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;
}
</style>
</head>
<body>
<div class="container">
<div class="content">
<div class="title">Laravel 5 XSLT engine template</div>
</div>
</div>
</body>
</xsl:template>
</xsl:stylesheet>
- 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 (https://github.com/barryvdh/laravel-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
<?php
namespace App\Listeners;
use DebugBar\DataCollector\MessagesCollector;
use DebugBar\DebugBar;
use Illuminate\Support\Facades\App;
use Krowinski\LaravelXSLT\Events\XSLTEngineEvent;
/**
* Class XSLTDebugBar
* @package App\Listeners
*/
class XSLTDebugBar
{
/**
* @param XSLTEngineEvent $event
*/
public function handle(XSLTEngineEvent $event)
{
$dom = new \DOMDocument;
$dom->preserveWhiteSpace = false;
$dom->loadXML($event->getExtendedSimpleXMLElement()->saveXML());
$dom->formatOutput = true;
$xmlString = $dom->saveXML();
/** @var DebugBar $debugBar */
$debugBar = App::make('debugbar');
if (!$debugBar->hasCollector('XML')) {
$debugBar->addCollector(new MessagesCollector('XML'));
}
/** @var MessagesCollector $collector */
$collector = $debugBar->getCollector('XML');
$collector->addMessage($xmlString, 'info', false);
}
}
Alternatives to krowinski/laravel-xslt
The standalone version Blade Template Engine from Laravel in a single php file
The standalone version of Laravel's Blade templating engine for use outside of L...
The standalone version of Laravel's Blade templating engine for use outside of L...
Version History
| Version | Released | PHP | Laravel | License |
|---|---|---|---|---|
| 3.0.0 | >=7.0 | 5.5.* | MIT | |
| 2.0.0 | >=5.5.9 | 5.4.* | MIT | |
| 1.0.0 | >=5.5.9 | 5.* | MIT | |
| 0.2.0 | >=5.5.9 | 5.* | MIT | |
| 0.1 | >=5.4.0 | 5.* | MIT |