Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not working with illuminate/view 11.8/11.9/11.10 #74

Open
pocketarc opened this issue Jun 11, 2024 · 10 comments
Open

Not working with illuminate/view 11.8/11.9/11.10 #74

pocketarc opened this issue Jun 11, 2024 · 10 comments

Comments

@pocketarc
Copy link

pocketarc commented Jun 11, 2024

With illuminate/view 11.7, it works fine. That's the current workaround, just require "illuminate/view": "~11.7.0".

illuminate/view 11.10:

Illuminate\Contracts\Container\BindingResolutionException [ 0 ]: Target class [blade.compiler] does not exist.
vendor/illuminate/container/Container.php:906

illuminate/view 11.9:

Illuminate\Contracts\Container\BindingResolutionException [ 0 ]: Target class [blade.compiler] does not exist.
vendor/illuminate/container/Container.php:906

illuminate/view 11.8:

Call to undefined function Illuminate\View\app()
vendor/illuminate/view/ViewServiceProvider.php:164
@sebacarrasco93
Copy link

sebacarrasco93 commented Jun 11, 2024

It's true, thank you!

Solved issue by doing after install this package:

composer require illuminate/view:11.7.0

@xewl
Copy link

xewl commented Jun 13, 2024

They moved away from grabbing the container via app() towards Illuminate/Container (Container::getInstance()), which resulted in this breaking.
I'm not sure if adding the Container is necessary, or if we'd have to switch it out with one of our own?

@askonomm
Copy link

askonomm commented Jul 2, 2024

Should probably add the requirement for illuminate/view into the README at the very least, no? Right now the out-of-box installation experience is a broken library with an odd error.

@pocketarc
Copy link
Author

Not even into the README - into the composer.json. Just change the version range allowed for this library. I might even raise a PR for that here, as a temporary measure.

@rvm-peercode
Copy link

Same goes for 10.48.11 and up.

@MrMarci666
Copy link

Thanks for the issue, please resolve

@MahmutHizal
Copy link

Its work for me

@ALameLlama
Copy link

ALameLlama commented Sep 30, 2024

I'm on view v10.48.20

Ended up doing something like this to get it working and it should work on v11.8+ too

use Jenssegers\Blade\Blade;
use Jenssegers\Blade\Container;
...

        $container = new Container();

        Container::setInstance($container);

        $this->blade = new Blade(
            $this->getView()->getViewsDir(),
            storage_path('views'),
            $container,
        );

https://github.com/illuminate/view/blob/master/ViewServiceProvider.php#L165

@MSHADroo
Copy link

MSHADroo commented Oct 1, 2024

I'm on view v10.48.20

ended up doing something like this to get it working

use Jenssegers\Blade\Blade;
use Jenssegers\Blade\Container;
...

        $container = new Container();

        Container::setInstance($container);

        $this->blade = new Blade(
            $this->getView()->getViewsDir(),
            storage_path('views'),
            $container,
        );

Thanks whis work for me on blade v11.25.0

@lehmayr
Copy link

lehmayr commented Oct 18, 2024

As ALameLlama said, it's enough to instantiate the singleton Illuminate Container before/when instantiating Jensseger's Blade. You can also do that by simply calling Container::getInstance(), i.e.
new Blade(..., ..., Container::getInstance())

i.e. a possible solution for Jenssegers would be to change the first line of Blade::__construct:

public function __construct($viewPaths, string $cachePath, ContainerInterface $container = null)
    {
        $this->container = $container ?: Container::getInstance();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants