Changed structure

This commit is contained in:
2021-10-13 21:57:32 -03:00
parent 956f791a0d
commit 6a7b98f869
4 changed files with 17 additions and 28 deletions

View File

@ -1,7 +1,4 @@
# Slim-Blade-View # Slim-Views-Blade
[![Build Status](https://travis-ci.org/rubellum/Slim-Blade-View.svg?branch=master)](https://travis-ci.org/rubellum/Slim-Blade-View)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
This is a Slim Framework view helper built on top of the Blade component. This is a Slim Framework view helper built on top of the Blade component.
@ -12,10 +9,10 @@ You can use this component to create and render templates in your Slim Framework
Via [Composer](https://getcomposer.org/) Via [Composer](https://getcomposer.org/)
```bash ```bash
$ composer require rubellum/slim-blade-view $ composer require provm/slim-views-blade
``` ```
Requires Slim Framework 3 and PHP 5.5.0 or newer. Requires Slim Framework 4 and PHP 7 or newer.
## Usage ## Usage

View File

@ -1,11 +1,11 @@
{ {
"name": "rubellum/slim-blade-view", "name": "provm/slim-views-blade",
"type": "library", "type": "library",
"description": "Slim Framework 3 view helper built on the Blade component", "description": "Slim Framework 4 view helper built on the Blade component",
"keywords": [ "keywords": [
"slim", "slim",
"framework", "framework",
"view", "views",
"template", "template",
"blade", "blade",
"renderer" "renderer"
@ -13,14 +13,12 @@
"license": "MIT", "license": "MIT",
"authors": [ "authors": [
{ {
"name": "Hiroaki Matsuura", "name": "Aldarien",
"email": "lib2jp@gmail.com" "email": "aldarien85@gmail.com"
} }
], ],
"require": { "require": {
"illuminate/view": "5.*", "eftec/bladeone": "^4"
"philo/laravel-blade": "3.*",
"psr/http-message": "^1.0"
}, },
"autoload": { "autoload": {
"psr-4": { "psr-4": {
@ -29,6 +27,6 @@
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "^4.0", "phpunit/phpunit": "^4.0",
"slim/slim": "^3.0" "slim/slim": "^4.0"
} }
} }

View File

@ -1,6 +1,6 @@
{ {
"require": { "require": {
"slim/slim": "^3.0", "slim/slim": "^4.0",
"rubellum/slim-blade-view": "^0.1.1" "provm/slim-views-blade": "^1"
} }
} }

View File

@ -2,7 +2,6 @@
namespace Slim\Views; namespace Slim\Views;
use Illuminate\Events\Dispatcher;
use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ResponseInterface;
class Blade class Blade
@ -17,11 +16,6 @@ class Blade
*/ */
protected $cachePath; protected $cachePath;
/**
* @var Dispatcher|null
*/
protected $events;
/** /**
* @var array * @var array
*/ */
@ -31,16 +25,15 @@ class Blade
* Blade constructor. * Blade constructor.
* @param array $viewPaths * @param array $viewPaths
* @param $cachePath * @param $cachePath
* @param Dispatcher|null $events * @param array $attributes
*/ */
public function __construct($viewPaths = [], $cachePath = '', Dispatcher $events = null, $attributes = []) public function __construct($viewPaths = [], $cachePath = '', $attributes = [])
{ {
if (is_string($viewPaths)) { if (is_string($viewPaths)) {
$viewPaths = [$viewPaths]; $viewPaths = [$viewPaths];
} }
$this->viewPaths = $viewPaths; $this->viewPaths = $viewPaths;
$this->cachePath = $cachePath; $this->cachePath = $cachePath;
$this->events = $events;
$this->attributes = $attributes; $this->attributes = $attributes;
} }
@ -169,7 +162,8 @@ class Blade
$data = array_merge($this->attributes, $data); $data = array_merge($this->attributes, $data);
$renderer = new \Philo\Blade\Blade($this->viewPaths, $this->cachePath, $this->events); //$renderer = new \Philo\Blade\Blade($this->viewPaths, $this->cachePath, $this->events);
return $renderer->view()->make($template, $data)->render(); $renderer = new BladeOne($this->getViewPaths(), $this->getCachePath());
return $renderer->run($template, $data);
} }
} }