Coder Social home page Coder Social logo

duncan3dc / blade Goto Github PK

View Code? Open in Web Editor NEW
142.0 6.0 36.0 878 KB

Use Blade templates without the full Laravel framework

License: Apache License 2.0

PHP 96.93% HTML 0.78% CSS 0.05% Dockerfile 0.76% Blade 1.47%
php blade-template laravel-framework templating

blade's People

Contributors

duncan3dc avatar geosot avatar jawngee avatar marcwiest avatar motian avatar peter279k avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

blade's Issues

throw new InvalidArgumentException("View [$name] not found.");

Hello,

Im learning PHP and im following a course via a website. The instructor uses this package for templating. And we learned about using routes controllers etc.
Now we switched from Twig -> Blade. And im having a problem.

This is my BaseController.php

namespace Nrs\controllers;

use duncan3dc\Laravel\BladeInstance;

class BaseController
{
    protected $Blade;

    public function __construct()
    {
        $this->Blade = new BladeInstance("/views/", "/cache/views/");
    }
}

And this is my PageController:

namespace Nrs\controllers;

use duncan3dc\Laravel\BladeInstance;
class PageController extends BaseController
{
    public function getShowHomePage()
    {
      echo $this->Blade->render("home");
    }
}

Im getting the error in my Title of this issue.
Getting stuck for ever now. Hope i allowed here to post it.
Sorry for my English
Tino

Where are Document this package

Hi guys,

I'm can find document this package.

I'm found some method: ->share() , ->with(), ->make() ...
I'm want find full method have into blade this and tutorial .

Thanks !

Could not reach BladeInstance->getViewFactory() method

Hi, I want to add file extension like these;

$instance = new BladeInstance($views, $cache);
$instance->getViewFactory()->addExtension('blade', 'blade');
$instance->getViewFactory()->addExtension('html', 'php');

But, that method is protected, and i cant reach it outside of the class.
Could you set it to public or add new public method to reach it?

Thanks.

Non existent variable does not throw ErrorException

Calling a non-existent variable seems not throw any ErrorException.

{{ $non_existent }}

It just silently running without a thing. Interesting enough, that every non-existent variable got default value of null.

@if ($non_existent == null)
    <div>It does exist, but null</div>
@endif

Should it be throw an ErrorException? or is it excpected behaviour?

Nothing

I use your package and I use it like that:

blade = new BladeInstance("src/Views"); } ``` } and query('SELECT * FROM forgecms_pages WHERE slug=?', [$slug])->fetch(); $this->blade->render('Pages.show'); } ``` } and I don't have InvalidArgumentException but nothing display Can you help me ?

Parser error on webhost

I'm getting the follow error on my webhost, on my localhost everything is okay:

syntax error, unexpected '.'

And this is triggered in line 63:

public static function __callStatic($name, array $arguments)
{
        return static::getInstance()->$name(...$arguments);
}

Any ideas what could be wrong?
Thanks

I've got Problem when I try install it with Symfony.

I want to try Blade in Symfony instead of Twig. For this I try install your Blade implementation, but I have a problem during installation:

Problem 1
- Conclusion: remove symfony/symfony v3.1.2
- Conclusion: don't install symfony/symfony v3.1.2
- duncan3dc/blade 2.2.0 requires illuminate/view ~5.1.0 -> satisfiable by illuminate/view[v5.1.1, v5.1.13, v5.1.16, v5.1.2, v5.1.20, v5.1.22, v5.1.25, v5.1.28, v5.1.30, v5.1.31, v5.1.41, v5.1.6, v5.1
.8].
- duncan3dc/blade 2.2.1 requires illuminate/view ~5.1.0 -> satisfiable by illuminate/view[v5.1.1, v5.1.13, v5.1.16, v5.1.2, v5.1.20, v5.1.22, v5.1.25, v5.1.28, v5.1.30, v5.1.31, v5.1.41, v5.1.6, v5.1
.8].
- illuminate/view v5.1.1 requires illuminate/filesystem 5.1.* -> satisfiable by illuminate/filesystem[v5.1.1, v5.1.13, v5.1.16, v5.1.2, v5.1.20, v5.1.22, v5.1.25, v5.1.28, v5.1.30, v5.1.31, v5.1.41,
v5.1.6, v5.1.8].
- illuminate/view v5.1.13 requires illuminate/filesystem 5.1.* -> satisfiable by illuminate/filesystem[v5.1.1, v5.1.13, v5.1.16, v5.1.2, v5.1.20, v5.1.22, v5.1.25, v5.1.28, v5.1.30, v5.1.31, v5.1.41,
v5.1.6, v5.1.8].
- illuminate/view v5.1.16 requires illuminate/filesystem 5.1.* -> satisfiable by illuminate/filesystem[v5.1.1, v5.1.13, v5.1.16, v5.1.2, v5.1.20, v5.1.22, v5.1.25, v5.1.28, v5.1.30, v5.1.31, v5.1.41,
v5.1.6, v5.1.8].
- illuminate/view v5.1.2 requires illuminate/filesystem 5.1.* -> satisfiable by illuminate/filesystem[v5.1.1, v5.1.13, v5.1.16, v5.1.2, v5.1.20, v5.1.22, v5.1.25, v5.1.28, v5.1.30, v5.1.31, v5.1.41,
v5.1.6, v5.1.8].
- illuminate/view v5.1.20 requires illuminate/filesystem 5.1.* -> satisfiable by illuminate/filesystem[v5.1.1, v5.1.13, v5.1.16, v5.1.2, v5.1.20, v5.1.22, v5.1.25, v5.1.28, v5.1.30, v5.1.31, v5.1.41,
v5.1.6, v5.1.8].
- illuminate/view v5.1.22 requires illuminate/filesystem 5.1.* -> satisfiable by illuminate/filesystem[v5.1.1, v5.1.13, v5.1.16, v5.1.2, v5.1.20, v5.1.22, v5.1.25, v5.1.28, v5.1.30, v5.1.31, v5.1.41,
v5.1.6, v5.1.8].
- illuminate/view v5.1.25 requires illuminate/filesystem 5.1.* -> satisfiable by illuminate/filesystem[v5.1.1, v5.1.13, v5.1.16, v5.1.2, v5.1.20, v5.1.22, v5.1.25, v5.1.28, v5.1.30, v5.1.31, v5.1.41,
v5.1.6, v5.1.8].
- illuminate/view v5.1.28 requires illuminate/filesystem 5.1.* -> satisfiable by illuminate/filesystem[v5.1.1, v5.1.13, v5.1.16, v5.1.2, v5.1.20, v5.1.22, v5.1.25, v5.1.28, v5.1.30, v5.1.31, v5.1.41,
v5.1.6, v5.1.8].
- illuminate/view v5.1.30 requires illuminate/filesystem 5.1.* -> satisfiable by illuminate/filesystem[v5.1.1, v5.1.13, v5.1.16, v5.1.2, v5.1.20, v5.1.22, v5.1.25, v5.1.28, v5.1.30, v5.1.31, v5.1.41,
v5.1.6, v5.1.8].
- illuminate/view v5.1.31 requires illuminate/filesystem 5.1.* -> satisfiable by illuminate/filesystem[v5.1.1, v5.1.13, v5.1.16, v5.1.2, v5.1.20, v5.1.22, v5.1.25, v5.1.28, v5.1.30, v5.1.31, v5.1.41,
v5.1.6, v5.1.8].
- illuminate/view v5.1.6 requires illuminate/filesystem 5.1.* -> satisfiable by illuminate/filesystem[v5.1.1, v5.1.13, v5.1.16, v5.1.2, v5.1.20, v5.1.22, v5.1.25, v5.1.28, v5.1.30, v5.1.31, v5.1.41,
v5.1.6, v5.1.8].
- illuminate/view v5.1.8 requires illuminate/filesystem 5.1.* -> satisfiable by illuminate/filesystem[v5.1.1, v5.1.13, v5.1.16, v5.1.2, v5.1.20, v5.1.22, v5.1.25, v5.1.28, v5.1.30, v5.1.31, v5.1.41,
v5.1.6, v5.1.8].
- illuminate/filesystem v5.1.1 requires symfony/finder 2.7.* -> satisfiable by symfony/finder[v2.7.0, v2.7.1, v2.7.10, v2.7.11, v2.7.12, v2.7.13, v2.7.14, v2.7.15, v2.7.16, v2.7.2, v2.7.3, v2.7.4, v2
.7.5, v2.7.6, v2.7.7, v2.7.8, v2.7.9].
- illuminate/filesystem v5.1.13 requires symfony/finder 2.7.* -> satisfiable by symfony/finder[v2.7.0, v2.7.1, v2.7.10, v2.7.11, v2.7.12, v2.7.13, v2.7.14, v2.7.15, v2.7.16, v2.7.2, v2.7.3, v2.7.4, v
2.7.5, v2.7.6, v2.7.7, v2.7.8, v2.7.9].
- illuminate/filesystem v5.1.16 requires symfony/finder 2.7.* -> satisfiable by symfony/finder[v2.7.0, v2.7.1, v2.7.10, v2.7.11, v2.7.12, v2.7.13, v2.7.14, v2.7.15, v2.7.16, v2.7.2, v2.7.3, v2.7.4, v
2.7.5, v2.7.6, v2.7.7, v2.7.8, v2.7.9].
- illuminate/filesystem v5.1.2 requires symfony/finder 2.7.* -> satisfiable by symfony/finder[v2.7.0, v2.7.1, v2.7.10, v2.7.11, v2.7.12, v2.7.13, v2.7.14, v2.7.15, v2.7.16, v2.7.2, v2.7.3, v2.7.4, v2
.7.5, v2.7.6, v2.7.7, v2.7.8, v2.7.9].
- illuminate/filesystem v5.1.20 requires symfony/finder 2.7.* -> satisfiable by symfony/finder[v2.7.0, v2.7.1, v2.7.10, v2.7.11, v2.7.12, v2.7.13, v2.7.14, v2.7.15, v2.7.16, v2.7.2, v2.7.3, v2.7.4, v
2.7.5, v2.7.6, v2.7.7, v2.7.8, v2.7.9].
- illuminate/filesystem v5.1.22 requires symfony/finder 2.7.* -> satisfiable by symfony/finder[v2.7.0, v2.7.1, v2.7.10, v2.7.11, v2.7.12, v2.7.13, v2.7.14, v2.7.15, v2.7.16, v2.7.2, v2.7.3, v2.7.4, v
2.7.5, v2.7.6, v2.7.7, v2.7.8, v2.7.9].
- illuminate/filesystem v5.1.25 requires symfony/finder 2.7.* -> satisfiable by symfony/finder[v2.7.0, v2.7.1, v2.7.10, v2.7.11, v2.7.12, v2.7.13, v2.7.14, v2.7.15, v2.7.16, v2.7.2, v2.7.3, v2.7.4, v
2.7.5, v2.7.6, v2.7.7, v2.7.8, v2.7.9].
- illuminate/filesystem v5.1.28 requires symfony/finder 2.7.* -> satisfiable by symfony/finder[v2.7.0, v2.7.1, v2.7.10, v2.7.11, v2.7.12, v2.7.13, v2.7.14, v2.7.15, v2.7.16, v2.7.2, v2.7.3, v2.7.4, v
2.7.5, v2.7.6, v2.7.7, v2.7.8, v2.7.9].
- illuminate/filesystem v5.1.30 requires symfony/finder 2.7.* -> satisfiable by symfony/finder[v2.7.0, v2.7.1, v2.7.10, v2.7.11, v2.7.12, v2.7.13, v2.7.14, v2.7.15, v2.7.16, v2.7.2, v2.7.3, v2.7.4, v
2.7.5, v2.7.6, v2.7.7, v2.7.8, v2.7.9].
- illuminate/filesystem v5.1.31 requires symfony/finder 2.7.* -> satisfiable by symfony/finder[v2.7.0, v2.7.1, v2.7.10, v2.7.11, v2.7.12, v2.7.13, v2.7.14, v2.7.15, v2.7.16, v2.7.2, v2.7.3, v2.7.4, v
2.7.5, v2.7.6, v2.7.7, v2.7.8, v2.7.9].
- illuminate/filesystem v5.1.41 requires symfony/finder 2.7.* -> satisfiable by symfony/finder[v2.7.0, v2.7.1, v2.7.10, v2.7.11, v2.7.12, v2.7.13, v2.7.14, v2.7.15, v2.7.16, v2.7.2, v2.7.3, v2.7.4, v
2.7.5, v2.7.6, v2.7.7, v2.7.8, v2.7.9].
- illuminate/filesystem v5.1.6 requires symfony/finder 2.7.* -> satisfiable by symfony/finder[v2.7.0, v2.7.1, v2.7.10, v2.7.11, v2.7.12, v2.7.13, v2.7.14, v2.7.15, v2.7.16, v2.7.2, v2.7.3, v2.7.4, v2
.7.5, v2.7.6, v2.7.7, v2.7.8, v2.7.9].
- illuminate/filesystem v5.1.8 requires symfony/finder 2.7.* -> satisfiable by symfony/finder[v2.7.0, v2.7.1, v2.7.10, v2.7.11, v2.7.12, v2.7.13, v2.7.14, v2.7.15, v2.7.16, v2.7.2, v2.7.3, v2.7.4, v2
.7.5, v2.7.6, v2.7.7, v2.7.8, v2.7.9].
- illuminate/view v5.1.41 requires symfony/debug 2.7.* -> satisfiable by symfony/debug[v2.7.0, v2.7.1, v2.7.10, v2.7.11, v2.7.12, v2.7.13, v2.7.14, v2.7.15, v2.7.16, v2.7.2, v2.7.3, v2.7.4, v2.7.5, v
2.7.6, v2.7.7, v2.7.8, v2.7.9].
- don't install symfony/finder v2.7.0|don't install symfony/symfony v3.1.2
- don't install symfony/finder v2.7.1|don't install symfony/symfony v3.1.2
- don't install symfony/finder v2.7.10|don't install symfony/symfony v3.1.2
- don't install symfony/finder v2.7.11|don't install symfony/symfony v3.1.2
- don't install symfony/finder v2.7.12|don't install symfony/symfony v3.1.2
- don't install symfony/finder v2.7.13|don't install symfony/symfony v3.1.2
- don't install symfony/finder v2.7.14|don't install symfony/symfony v3.1.2
- don't install symfony/finder v2.7.15|don't install symfony/symfony v3.1.2
- don't install symfony/finder v2.7.16|don't install symfony/symfony v3.1.2
- don't install symfony/finder v2.7.2|don't install symfony/symfony v3.1.2
- don't install symfony/finder v2.7.3|don't install symfony/symfony v3.1.2
- don't install symfony/finder v2.7.4|don't install symfony/symfony v3.1.2
- don't install symfony/finder v2.7.5|don't install symfony/symfony v3.1.2
- don't install symfony/finder v2.7.6|don't install symfony/symfony v3.1.2
- don't install symfony/finder v2.7.7|don't install symfony/symfony v3.1.2
- don't install symfony/finder v2.7.8|don't install symfony/symfony v3.1.2
- don't install symfony/finder v2.7.9|don't install symfony/symfony v3.1.2
- don't install symfony/debug v2.7.0|don't install symfony/symfony v3.1.2
- don't install symfony/debug v2.7.1|don't install symfony/symfony v3.1.2
- don't install symfony/debug v2.7.10|don't install symfony/symfony v3.1.2
- don't install symfony/debug v2.7.11|don't install symfony/symfony v3.1.2
- don't install symfony/debug v2.7.12|don't install symfony/symfony v3.1.2
- don't install symfony/debug v2.7.13|don't install symfony/symfony v3.1.2
- don't install symfony/debug v2.7.14|don't install symfony/symfony v3.1.2
- don't install symfony/debug v2.7.15|don't install symfony/symfony v3.1.2
- don't install symfony/debug v2.7.16|don't install symfony/symfony v3.1.2
- don't install symfony/debug v2.7.2|don't install symfony/symfony v3.1.2
- don't install symfony/debug v2.7.3|don't install symfony/symfony v3.1.2
- don't install symfony/debug v2.7.4|don't install symfony/symfony v3.1.2
- don't install symfony/debug v2.7.5|don't install symfony/symfony v3.1.2
- don't install symfony/debug v2.7.6|don't install symfony/symfony v3.1.2
- don't install symfony/debug v2.7.7|don't install symfony/symfony v3.1.2
- don't install symfony/debug v2.7.8|don't install symfony/symfony v3.1.2
- don't install symfony/debug v2.7.9|don't install symfony/symfony v3.1.2
- Installation request for symfony/symfony (locked at v3.1.2, required as 3.1.*) -> satisfiable by symfony/symfony[v3.1.2].
- Installation request for duncan3dc/blade ^2.2 -> satisfiable by duncan3dc/blade[2.2.0, 2.2.1].

This is my composer.json

{
"name": "symfony/framework-standard-edition",
"license": "MIT",
"type": "project",
"description": "The "Symfony Standard Edition" distribution",
"autoload": {
"psr-4": { "": "src/" },
"classmap": [ "app/AppKernel.php", "app/AppCache.php" ]
},
"autoload-dev": {
"psr-4": { "Tests": "tests/" }
},
"require": {
"php": ">=5.5.9",
"symfony/symfony": "3.1.*",
"doctrine/orm": "^2.5",
"doctrine/doctrine-bundle": "^1.6",
"doctrine/doctrine-cache-bundle": "^1.2",
"symfony/swiftmailer-bundle": "^2.3",
"symfony/monolog-bundle": "^2.8",
"symfony/polyfill-apcu": "^1.0",
"sensio/distribution-bundle": "^5.0",
"sensio/framework-extra-bundle": "^3.0.2",
"incenteev/composer-parameter-handler": "^2.0"
},
"require-dev": {
"sensio/generator-bundle": "^3.0",
"symfony/phpunit-bridge": "^3.0"
},
"scripts": {
"post-install-cmd": [
"Incenteev\ParameterHandler\ScriptHandler::buildParameters",
"Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap",
"Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache",
"Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installAssets",
"Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installRequirementsFile",
"Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::prepareDeploymentTarget"
],
"post-update-cmd": [
"Incenteev\ParameterHandler\ScriptHandler::buildParameters",
"Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap",
"Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache",
"Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installAssets",
"Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installRequirementsFile",
"Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::prepareDeploymentTarget"
]
},
"config": {
"platform": {
"php": "5.5.9"
}
},
"extra": {
"symfony-app-dir": "app",
"symfony-bin-dir": "bin",
"symfony-var-dir": "var",
"symfony-web-dir": "web",
"symfony-tests-dir": "tests",
"symfony-assets-install": "relative",
"incenteev-parameters": {
"file": "app/config/parameters.yml"
},
"branch-alias": {
"dev-master": "3.1-dev"
}
}
}

In
May be you know how I can solve this problem?
Thanks!

Can't use the "$this"

I can't use the $this instance using the blade template engine.

Example:

{{ $this->config->item() }}
{{ $this->session->flashdata() }}
Type: ErrorException
Message: Call to a member function flashdata() on null

Extend template from another folder

Hi,
imagine the following folders structure

└── app/
    ├── layouts/
    │   ├── master.blade.php
    │   └── login.blade.php
    └── packages/
        ├── users/
        │   ├── list.blade.php
        │   └── add.blade.php
        └── products/
            ├── list.blade.php
            └── add.blade.php

I've added booth app/layouts/ and app/packages/ to the Blade instance. When I render products.list without extending it works fine, as well as if I render master or login.

But when I try to @extends('master') in list.blade.php it doesn't work because it will look only in that folder that it is already in. For example in users folder only.

How can you achieve this?
Cheers.

Add view composers

It would be great if we could use view composers, just like with Blade when using Laravel.

View::composer('sidebar', function($view) {
    $view->with('links', ['hello','world!']);
});

I've been digging in the Laravel (Illuminate) codebase, but I couldn't find myself what I was looking for.

Please add support for PHP 8.2

In this moment when we try to use the package with php8.2 gives a fatal error and there is not any update of this package. Other packages too don't have support for php8.2

image

The IDE shows error

Hello! I am using PHPStorm IDE and installed your library. Now it shows error on the blade page, the doctype is underlined by red:

@use(App\Models\Menu)

<!DOCTYPE html>
...

Also, when i write smth like:
{{ Menu::buildMenu($menu) }}
in the code below, there is no smart help of IDE as if i write the full path:
{{ \App\Models\Menu::buildMenu($menu) }}
in the 2nd before method is called - ide shows a list of possible methods.
Can this problems be somehow fixed?
Thanks.

suggestion for configuration

First of all, thank you for this wonderful and up-to-date package; it's a gem.

I realize that there is not much to the package itself to warrant talking to the .env file, but it would be wonderful if the asset shortcut you have provided could take variables (while keeping your prepended defaults for css/js)

I hope this is a reasonable suggestion because this package serves those us who do not want the full-Laravel treatment. I would like to be able to keep my boilerplate folder structure while making your blade repo my default viewer. Since you have made such a nice addition to blade, I thought to ask.

Thanks a bunch for your work. It is much appreciated.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.