首页 > 其他分享 >laravel 服务别名的理解

laravel 服务别名的理解

时间:2023-02-25 13:22:15浏览次数:35  
标签:laravel cache Illuminate Contracts Cache Factory 别名 理解 array

先看下容器别名数组属性是什么

container aliases属性

$arr = [
  "Illuminate\Foundation\Application" => "app"
  "Illuminate\Contracts\Container\Container" => "app"
  "Illuminate\Contracts\Foundation\Application" => "app"
  "Psr\Container\ContainerInterface" => "app"
  "Illuminate\Auth\AuthManager" => "auth"
  "Illuminate\Contracts\Auth\Factory" => "auth"
  "Illuminate\Contracts\Auth\Guard" => "auth.driver"
  "Illuminate\View\Compilers\BladeCompiler" => "blade.compiler"
  "Illuminate\Cache\CacheManager" => "cache"
  "Illuminate\Contracts\Cache\Factory" => "cache"
  "Illuminate\Cache\Repository" => "cache.store"
  "Illuminate\Contracts\Cache\Repository" => "cache.store"
  "Psr\SimpleCache\CacheInterface" => "cache.store"
  "Symfony\Component\Cache\Adapter\Psr16Adapter" => "cache.psr6"
  "Symfony\Component\Cache\Adapter\AdapterInterface" => "cache.psr6"
  "Psr\Cache\CacheItemPoolInterface" => "cache.psr6"
  "Illuminate\Redis\Connections\Connection" => "redis.connection"
  "Illuminate\Contracts\Redis\Connection" => "redis.connection"
  "Illuminate\Http\Request" => "request"
  "Symfony\Component\HttpFoundation\Request" => "request"
  "Illuminate\Routing\Router" => "router"
  "Illuminate\Contracts\Routing\Registrar" => "router"
  "Illuminate\Contracts\Routing\BindingRegistrar" => "router"
  "Illuminate\Session\SessionManager" => "session"
  "Illuminate\Session\Store" => "session.store"
  "Illuminate\Contracts\Session\Session" => "session.store"
  "Illuminate\Routing\UrlGenerator" => "url"
  "Illuminate\Contracts\Routing\UrlGenerator" => "url"
  "Illuminate\Validation\Factory" => "validator"
  "Illuminate\Contracts\Validation\Factory" => "validator"
  "Illuminate\View\Factory" => "view"
  "Illuminate\Contracts\View\Factory" => "view"
] 

 

再看下 抽象属性  

abstractAliases

$arr=  [
  "app" => array:4 [                                  
    0 => "Illuminate\Foundation\Application"          
    1 => "Illuminate\Contracts\Container\Container"   
    2 => "Illuminate\Contracts\Foundation\Application"
    3 => "Psr\Container\ContainerInterface"           
  ]                                                   
  "auth" => array:2 [                                 
    0 => "Illuminate\Auth\AuthManager"                
    1 => "Illuminate\Contracts\Auth\Factory"          
  ]                                                   
  "auth.driver" => array:1 [                          
    0 => "Illuminate\Contracts\Auth\Guard"
  ]
  "blade.compiler" => array:1 [
    0 => "Illuminate\View\Compilers\BladeCompiler"
  ]
  "cache" => array:2 [
    0 => "Illuminate\Cache\CacheManager"
    1 => "Illuminate\Contracts\Cache\Factory"
  ]
  "cache.store" => array:3 [
    0 => "Illuminate\Cache\Repository"
    1 => "Illuminate\Contracts\Cache\Repository"
    2 => "Psr\SimpleCache\CacheInterface"
  ]
  "cache.psr6" => array:3 [
    0 => "Symfony\Component\Cache\Adapter\Psr16Adapter"
    1 => "Symfony\Component\Cache\Adapter\AdapterInterface"
    2 => "Psr\Cache\CacheItemPoolInterface"
  ]
  "config" => array:2 [
    0 => "Illuminate\Config\Repository"
    1 => "Illuminate\Contracts\Config\Repository"
  ]
  "cookie" => array:3 [
    0 => "Illuminate\Cookie\CookieJar"
    1 => "Illuminate\Contracts\Cookie\Factory"
    2 => "Illuminate\Contracts\Cookie\QueueingFactory"
  ]
  "db" => array:2 [
    0 => "Illuminate\Database\DatabaseManager"
    1 => "Illuminate\Database\ConnectionResolverInterface"
  ]
  "db.connection" => array:2 [
    0 => "Illuminate\Database\Connection"
    1 => "Illuminate\Database\ConnectionInterface"
  ]
  "encrypter" => array:3 [
    0 => "Illuminate\Encryption\Encrypter"
    1 => "Illuminate\Contracts\Encryption\Encrypter"
    2 => "Illuminate\Contracts\Encryption\StringEncrypter"
  ]
  "events" => array:2 [
    0 => "Illuminate\Events\Dispatcher"
    1 => "Illuminate\Contracts\Events\Dispatcher"
  ]
  "files" => array:1 [
    0 => "Illuminate\Filesystem\Filesystem"
  ]
  "filesystem" => array:2 [
    0 => "Illuminate\Filesystem\FilesystemManager"
    1 => "Illuminate\Contracts\Filesystem\Factory"
  ]
  "filesystem.disk" => array:1 [
    0 => "Illuminate\Contracts\Filesystem\Filesystem"
  ]
  "filesystem.cloud" => array:1 [
    0 => "Illuminate\Contracts\Filesystem\Cloud"
  ]
  "hash" => array:1 [
    0 => "Illuminate\Hashing\HashManager"
  ]
  "hash.driver" => array:1 [
    0 => "Illuminate\Contracts\Hashing\Hasher"
  ]
  "translator" => array:2 [
    0 => "Illuminate\Translation\Translator"
    1 => "Illuminate\Contracts\Translation\Translator"
  ]
  "log" => array:2 [
    0 => "Illuminate\Log\LogManager"
    1 => "Psr\Log\LoggerInterface"
  ]
  "mail.manager" => array:2 [
    0 => "Illuminate\Mail\MailManager"
    1 => "Illuminate\Contracts\Mail\Factory"
  ]
  "mailer" => array:3 [
    0 => "Illuminate\Mail\Mailer"
    1 => "Illuminate\Contracts\Mail\Mailer"
    2 => "Illuminate\Contracts\Mail\MailQueue"
  ]
  "auth.password" => array:2 [
    0 => "Illuminate\Auth\Passwords\PasswordBrokerManager"
    1 => "Illuminate\Contracts\Auth\PasswordBrokerFactory"
  ]
  "auth.password.broker" => array:2 [
    0 => "Illuminate\Auth\Passwords\PasswordBroker"
    1 => "Illuminate\Contracts\Auth\PasswordBroker"
  ]
  "queue" => array:3 [
    0 => "Illuminate\Queue\QueueManager"
    1 => "Illuminate\Contracts\Queue\Factory"
    2 => "Illuminate\Contracts\Queue\Monitor"
  ]
  "queue.connection" => array:1 [
    0 => "Illuminate\Contracts\Queue\Queue"
  ]
  "queue.failer" => array:1 [
    0 => "Illuminate\Queue\Failed\FailedJobProviderInterface"
  ]
  "redirect" => array:1 [
    0 => "Illuminate\Routing\Redirector"
  ]
  "redis" => array:2 [
    0 => "Illuminate\Redis\RedisManager"
    1 => "Illuminate\Contracts\Redis\Factory"
  ]
  "redis.connection" => array:2 [
    0 => "Illuminate\Redis\Connections\Connection"
    1 => "Illuminate\Contracts\Redis\Connection"
  ]
  "request" => array:2 [
    0 => "Illuminate\Http\Request"
    1 => "Symfony\Component\HttpFoundation\Request"
  ]
  "router" => array:3 [
    0 => "Illuminate\Routing\Router"
    1 => "Illuminate\Contracts\Routing\Registrar"
    2 => "Illuminate\Contracts\Routing\BindingRegistrar"
  ]
  "session" => array:1 [
    0 => "Illuminate\Session\SessionManager"
  ]
  "session.store" => array:2 [
    0 => "Illuminate\Session\Store"
    1 => "Illuminate\Contracts\Session\Session"
  ]
  "url" => array:2 [
    0 => "Illuminate\Routing\UrlGenerator"
    1 => "Illuminate\Contracts\Routing\UrlGenerator"
  ]
  "validator" => array:2 [
    0 => "Illuminate\Validation\Factory"
    1 => "Illuminate\Contracts\Validation\Factory"
  ]
  "view" => array:2 [
    0 => "Illuminate\View\Factory"
    1 => "Illuminate\Contracts\View\Factory"
  ]
]

  

 

标签:laravel,cache,Illuminate,Contracts,Cache,Factory,别名,理解,array
From: https://www.cnblogs.com/cbywan/p/17154231.html

相关文章

  • 如何理解面向接口编程与面向实现编程
    以HeadFirst中的一张图为例,说明这个问题:假设我们有一个应用程序加simuduck,用户可以执行simuduck-pxxx,其中xxx是鸭子的类型,然后程序会根据用户的输入生成不同的鸭......
  • 深入理解图像信号处理器 ISP
    https://zhuanlan.zhihu.com/p/139394687写在前面,本文为笔者参考了很多篇博客,传感器手册,芯片手册,汇总了ISP可能涉及到的步骤流程,整理所得万字长文,并针对ISP芯片流程图......
  • 理解MVCC
    MVCC就是多版本并发控制。MVCC是一种并发控制的方法,一般在数据库管理系统中,实现对数据库的并发访问。为什么需要MVCC呢?数据库通常使用锁来实现隔离性。最原生的锁,锁住一......
  • 理解JS函数之call,apply,bind
    前言在JavaScript中,apply、bind和call是三个重要的函数,它们都是Function.prototype的方法。这些函数可以让我们动态地改变函数的this值,或者传递参数来执行函数。......
  • 关于汉诺塔的最简单理解
    最简单的汉诺塔算法解析,看不懂可以刀我今天给大家带来一个汉诺塔算法的讲解,应该是最简单的理解方法,首先我们得知道汉诺塔游戏规则,不会有人搜这个然后不知道规则吧?不会吧?......
  • Vue中的nextTick理解
    一、NextTick是什么官方定义:在下次DOM更新循环结束之后执行延迟回调。在修改数据之后立即使用这个方法,获取更新后的DOM。我们可以理解成,Vue在更新DOM时是异步执行......
  • Go语言并发编程:对进程、线程、协程和并发、并行的理解
    Go语言并发编程:进程、线程、协程和并发、并行的理解一、进程和线程对操作系统进程和线程以及协程的了解,可以看看我前面的文章:对进程、线程和协程的理解以及它们的区别......
  • laravel groupby 报错
    报错信息laravelwhichisnotfunctionallydependentoncolumnsinGROUPBYclause;thisisincompatiblewithsql_mode=only_full_group_by关闭严格模式:修改app......
  • 深入理解Python装饰器
    Bydefinition,adecoratorisafunctionthattakesanotherfunctionandextendsthebehaviorofthelatterfunctionwithoutexplicitlymodifyingit.装饰器可......
  • 仅“2k”字就能理解的async/await原理,摸个鱼的时间搞定它
    前言上篇文章​​5K字由浅入深聊聊Promise实现原理​​,中讲述了Promise内部的实现原理。今天来聊聊​​async​​与​​await​​,那么async与await到底是什么呢。都说是​......