天道酬勤,学无止境

thephpleague

依赖注入不适用于 League\Route 和 League\Container(Dependency injection not working with League\Route and League\Container)

问题 我现在正在构建一个 Web 应用程序,但我的控制器遇到了问题。 我想将我的 League\Plate\Engine(在我的容器中注册)发送到我的控制器,但我一直遇到相同的错误: Argument 3 passed to App\Controller\Main::index() must be an instance of League\Plates\Engine, array given 这是我的文件: 依赖.php use League\Container\Container; use Monolog\Handler\StreamHandler; use Monolog\Logger; use Yajra\Pdo\Oci8; use League\Container\ReflectionContainer; $container = new Container(); // Active auto-wiring $container->delegate( new ReflectionContainer ); // Others dependencies // ... // Views $container->add('view', function () { $templates = new League\Plates\Engine(); $templates-

2021-10-15 16:12:05    分类:技术分享    php   dependency-injection   containers   thephpleague

指导我使用 phpleague 库实现 Oauth2 PHP 服务器(Guide me implementing Oauth2 PHP server using thephpleague library)

问题 我正在使用带有 Eloquent ORM 的Slim Framework 。 试图实现 https://github.com/thephpleague/oauth2-server 但我完全困惑如何做到这一点。 用 composer 添加这个之后,我用这个包中提供的 sql 文件创建了数据库。 现在建议实现Storage接口。 我不想这样做,所以我只是复制了在示例文件夹中找到的存储类。 我想它们应该可以工作,因为我使用的是相同的数据库,对吗? 也不清楚最初如何为数据库播种。 这是我正在尝试密码方法的路由器。 $server = new \League\OAuth2\Server\AuthorizationServer; $server->setSessionStorage(new SessionStorage); $server->setAccessTokenStorage(new AccessTokenStorage); $server->setClientStorage(new ClientStorage); $server->setScopeStorage(new ScopeStorage); $passwordGrant = new \League\OAuth2\Server\Grant\PasswordGrant(); $passwordGrant-

2021-09-14 16:04:15    分类:技术分享    php   oauth   eloquent   slim   thephpleague

Dependency injection not working with League\Route and League\Container

I'm building a web application right now and I'm facing a problem with my controller. I want to send to my controller my League\Plate\Engine (registred in my Container) but I keep having the same error : Argument 3 passed to App\Controller\Main::index() must be an instance of League\Plates\Engine, array given Here is my files : dependencies.php use League\Container\Container; use Monolog\Handler\StreamHandler; use Monolog\Logger; use Yajra\Pdo\Oci8; use League\Container\ReflectionContainer; $container = new Container(); // Active auto-wiring $container->delegate( new ReflectionContainer ); //

2021-09-08 01:21:17    分类:问答    php   dependency-injection   containers   thephpleague

Guide me implementing Oauth2 PHP server using thephpleague library

I am using Slim Framework With Eloquent ORM. Trying to implement https://github.com/thephpleague/oauth2-server but I am totally confused how to do this. After adding this with composer, I created database with sql file provided in this package. Now it is suggested to implement Storage interfaces. I don't wanna do this, So I just copied storage classes found in Example Folder. I guess they should work as I am using same database right? Also it is unclear how to initially seed the db. Here's my router where I am trying password method. $server = new \League\OAuth2\Server\AuthorizationServer;

2021-06-03 07:59:28    分类:问答    php   oauth   eloquent   slim   thephpleague

Replicating claims as headers is deprecated and will removed from v4.0 - Laravel Passport Problem in lcobucci/jwt package

I'm using laravel/passport:7.5.1 package in my laravel project and recently faced with this exception. Any Idea? I temperory downgrade the lcobucci/jwt:3.4.0 package to lcobucci/jwt:3.3.3 Replicating claims as headers is deprecated and will removed from v4.0. Please manually set the header if you need it replicated. Stack Trace: "exception": { "trace": [ "/var/www/app/vendor/lcobucci/jwt/src/Builder.php:334", "/var/www/app/vendor/lcobucci/jwt/src/Builder.php:185", "/var/www/app/vendor/lcobucci/jwt/src/Builder.php:201", "/var/www/app/vendor/league/oauth2-server/src/Entities/Traits

2021-06-01 07:10:24    分类:问答    php   laravel   laravel-passport   thephpleague