当前位置: 首页>>代码示例>>PHP>>正文


PHP Application::instance方法代码示例

本文整理汇总了PHP中Illuminate\Contracts\Foundation\Application::instance方法的典型用法代码示例。如果您正苦于以下问题:PHP Application::instance方法的具体用法?PHP Application::instance怎么用?PHP Application::instance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Illuminate\Contracts\Foundation\Application的用法示例。


在下文中一共展示了Application::instance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: sendRequestThroughRouter

 /**
  * Send through our custom router
  *
  * @param $request
  *
  * @return Response
  */
 protected function sendRequestThroughRouter($request)
 {
     $this->app->instance('request', $request);
     return (new Pipeline($this->app))->send($request)->through($this->middleware)->then(function ($request) {
         return $this->router->dispatch($this->alexaRequest);
     });
 }
开发者ID:develpr,项目名称:alexa-app,代码行数:14,代码来源:Request.php

示例2: createFreshMockInstance

 /**
  * Create a fresh mock instance for the given class.
  *
  * @param  string  $name
  * @return \Mockery\Expectation
  */
 protected static function createFreshMockInstance($name)
 {
     static::$resolvedInstance[$name] = $mock = static::createMockByName($name);
     if (isset(static::$app)) {
         static::$app->instance($name, $mock);
     }
     return $mock;
 }
开发者ID:woakes070048,项目名称:laravel,代码行数:14,代码来源:Facade.php

示例3: createFreshMockInstance

 /**
  * Create a fresh mock instance for the given class.
  *
  * @param  string  $name
  * @return \Mockery\Expectation
  */
 protected static function createFreshMockInstance($name)
 {
     static::$resolvedInstance[$name] = $mock = static::createMockByName($name);
     $mock->shouldAllowMockingProtectedMethods();
     if (isset(static::$app)) {
         static::$app->instance($name, $mock);
     }
     return $mock;
 }
开发者ID:Alex--Jin,项目名称:homerapi,代码行数:15,代码来源:Facade.php

示例4: bootstrap

 /**
  * Bootstrap the given application.
  *
  * @param  \Illuminate\Contracts\Foundation\Application  $app
  *
  * @return void
  */
 public function bootstrap(Application $app)
 {
     $items = [];
     $app->instance('config', $config = new Repository($items));
     $this->loadConfigurationFiles($app, $config);
     mb_internal_encoding('UTF-8');
 }
开发者ID:diegopan,项目名称:testbench,代码行数:14,代码来源:LoadConfiguration.php

示例5: bootstrap

 /**
  * Bootstrap the given application.
  *
  * @param  \Illuminate\Contracts\Foundation\Application $app
  * @return void
  */
 public function bootstrap(Application $app)
 {
     /** @var \Illuminate\Foundation\Application $app*/
     $env = $app->environment();
     $filesystem = $this->files = new Filesystem();
     $loader = new FileLoader($filesystem, $app['path.config']);
     $config = new Repository($loader, $filesystem, $env);
     $loader->setRepository($config);
     $app->instance('config', $config);
     $configuredLoader = $app['config']->get('laradic_config.loader');
     if (isset($configuredLoader) && $configuredLoader !== 'file') {
         if ($configuredLoader === 'db') {
             $loader = new DatabaseLoader($filesystem, $app['path.config']);
             $config->setLoader($loader);
             $app->booted(function () use($app, $loader, $config) {
                 $loader->setDatabase($app['db']->connection());
                 $loader->setDatabaseTable($app['config']->get('laradic_config.loaders.db.table'));
             });
             $loader->setRepository($config);
         }
     }
     if (file_exists($cached = $app->getCachedConfigPath()) && !$app->runningInConsole()) {
         $items = (require $cached);
         $loadedFromCache = true;
     }
     if (!isset($loadedFromCache)) {
         # $this->loadConfigurationFiles($app, $config);
     }
     date_default_timezone_set($config['app.timezone']);
     mb_internal_encoding('UTF-8');
 }
开发者ID:laradic,项目名称:config,代码行数:37,代码来源:LoadConfiguration.php

示例6: dispatchToRouter

 /**
  * Get the route dispatcher callback.
  *
  * @return \Closure
  */
 protected function dispatchToRouter()
 {
     return function ($request) {
         $this->app->instance('request', $request);
         return $this->router->dispatch($request);
     };
 }
开发者ID:delatbabel,项目名称:framework,代码行数:12,代码来源:Kernel.php

示例7: registerLogger

 /**
  * Register the logger instance in the container.
  *
  * @param  \Illuminate\Foundation\Application|Application $app
  * @return \Illuminate\Log\Writer
  */
 protected function registerLogger(Application $app)
 {
     $logger = new Logger($app->environment());
     //< do not move this! it might produce "Class declarations may not be nested" error
     $log = new Writer($logger, $app['events']);
     $app->instance('log', $log);
     return $log;
 }
开发者ID:swayok,项目名称:laravel-extended-errors,代码行数:14,代码来源:ConfigureLogging.php

示例8: bootstrap

 /**
  * Bootstrap the given application.
  *
  * @param \Illuminate\Contracts\Foundation\Application|\Notadd\Foundation\Application $application
  *
  * @return void
  */
 public function bootstrap(Application $application)
 {
     $loader = new FileLoader(new Filesystem(), $application['path'] . DIRECTORY_SEPARATOR . 'configurations');
     $application->instance('config', $configuration = new Repository($loader, $application->environment()));
     if (!isset($loadedFromCache)) {
         $this->loadConfigurationFiles($application, $configuration);
     }
     mb_internal_encoding('UTF-8');
 }
开发者ID:notadd,项目名称:framework,代码行数:16,代码来源:LoadConfiguration.php

示例9: bootstrap

 /**
  * Bootstrap the given application.
  *
  * @param  \Illuminate\Contracts\Foundation\Application  $app
  * @return void
  */
 public function bootstrap(Application $app)
 {
     $fileLoader = new FileLoader(new Filesystem(), base_path() . '/config');
     $app->instance('config', $config = new Repository($fileLoader, $app['env']));
     date_default_timezone_set($config['app.timezone']);
     mb_internal_encoding('UTF-8');
     // Fix for XDebug aborting threads > 100 nested
     ini_set('xdebug.max_nesting_level', 300);
 }
开发者ID:brenodouglas,项目名称:library,代码行数:15,代码来源:LoadConfiguration.php

示例10: storeConfiguration

 protected function storeConfiguration()
 {
     $dbConfig = $this->dbConfig;
     $config = ['debug' => false, 'database' => ['driver' => $dbConfig['driver'], 'host' => $dbConfig['host'], 'database' => $dbConfig['database'], 'username' => $dbConfig['username'], 'password' => $dbConfig['password'], 'charset' => 'utf8mb4', 'collation' => 'utf8mb4_unicode_ci', 'prefix' => $dbConfig['prefix'], 'strict' => false], 'url' => $this->baseUrl, 'paths' => ['api' => 'api', 'admin' => 'admin']];
     $this->info('Testing config');
     $this->application->instance('flarum.config', $config);
     /* @var $db \Illuminate\Database\ConnectionInterface */
     $db = $this->application->make('flarum.db');
     $version = $db->getPdo()->getAttribute(PDO::ATTR_SERVER_VERSION);
     if (version_compare($version, '5.5.0', '<')) {
         throw new Exception('MySQL version too low. You need at least MySQL 5.5.');
     }
     $this->info('Writing config');
     file_put_contents($this->getConfigFile(), '<?php return ' . var_export($config, true) . ';');
 }
开发者ID:Luceos,项目名称:core,代码行数:15,代码来源:InstallCommand.php

示例11: bootstrap

 /**
  * @param \Illuminate\Contracts\Foundation\Application|\Notadd\Foundation\Application $application
  *
  * @return void
  */
 public function bootstrap(Application $application)
 {
     $items = [];
     if (file_exists($cached = $application->getCachedConfigPath())) {
         $items = (require $cached);
         $loadedFromCache = true;
     }
     $application->instance('config', $config = new Repository($items));
     if (!isset($loadedFromCache)) {
         $this->loadConfigurationFiles($application, $config);
     }
     $application->detectEnvironment(function () use($config) {
         return $config->get('app.env', 'production');
     });
     mb_internal_encoding('UTF-8');
 }
开发者ID:notadd,项目名称:framework,代码行数:21,代码来源:LoadConfiguration.php

示例12: __construct

 /**
  * Constructor
  */
 public function __construct(\Illuminate\Contracts\Foundation\Application $app)
 {
     $this->app = $app;
     $app->instance('application', $this);
     if (function_exists('ini_set') && extension_loaded('xdebug')) {
         ini_set('xdebug.show_exception_trace', false);
         ini_set('xdebug.scream', false);
     }
     // Config TimeZone
     if (function_exists('date_default_timezone_set') && function_exists('date_default_timezone_get')) {
         date_default_timezone_set(@date_default_timezone_get());
     }
     ErrorHandler::register();
     $this->bootstrap();
     parent::__construct($this->title, $this->version);
 }
开发者ID:consolle,项目名称:framework,代码行数:19,代码来源:Application.php

示例13: bootstrap

 /**
  * Bootstrap the given application.
  *
  * @param  \Illuminate\Contracts\Foundation\Application  $app
  * @return void
  */
 public function bootstrap(Application $app)
 {
     $logger = new Writer(new Monolog($app->environment()), $app['events']);
     // Daily files are better for production stuff
     $logger->useDailyFiles(storage_path('/logs/laravel.log'));
     $app->instance('log', $logger);
     // Next we will bind the a Closure to resolve the PSR logger implementation
     // as this will grant us the ability to be interoperable with many other
     // libraries which are able to utilize the PSR standardized interface.
     $app->bind('Psr\\Log\\LoggerInterface', function ($app) {
         return $app['log']->getMonolog();
     });
     $app->bind('Illuminate\\Contracts\\Logging\\Log', function ($app) {
         return $app['log'];
     });
 }
开发者ID:bitbitdecker,项目名称:bitcoin-faucet-rotator,代码行数:22,代码来源:ConfigureLogging.php

示例14: bootstrap

 /**
  * Bootstrap the given application.
  *
  * @param  \Illuminate\Contracts\Foundation\Application  $app
  * @return void
  */
 public function bootstrap(Application $app)
 {
     $items = [];
     // First we will see if we have a cache configuration file. If we do, we'll load
     // the configuration items from that file so that it is very quick. Otherwise
     // we will need to spin through every configuration file and load them all.
     if (file_exists($cached = storage_path('framework/config.php'))) {
         $items = (require $cached);
         $loadedFromCache = true;
     }
     $app->instance('config', $config = new Repository($items));
     // Next we will spin through all of the configuration files in the configuration
     // directory and load each one into the repository. This will make all of the
     // options available to the developer for use in various parts of this app.
     if (!isset($loadedFromCache)) {
         $this->loadConfigurationFiles($config);
     }
     date_default_timezone_set($config['app.timezone']);
 }
开发者ID:mmf,项目名称:framework,代码行数:25,代码来源:LoadConfiguration.php

示例15: bootstrap

 /**
  * Bootstrap the given application.
  *
  * @param  \Illuminate\Contracts\Foundation\Application  $app
  * @return void
  */
 public function bootstrap(Application $app)
 {
     $items = [];
     // First we will see if we have a cache configuration file. If we do, we'll load
     // the configuration items from that file so that it is very quick. Otherwise
     // we will need to spin through every configuration file and load them all.
     /*if (file_exists($cached = $app->getCachedConfigPath()))
     		{
     			$items = require $cached;
     
     			$loadedFromCache = true;
     		}*/
     $app->instance('config', $config = new IlluminatoRepository($items));
     // Next we will spin through all of the configuration files in the configuration
     // directory and load each one into the repository. This will make all of the
     // options available to the developer for use in various parts of this app.
     if (!isset($loadedFromCache)) {
         $this->loadConfigurationFiles($app->configPath(), $config);
     }
     date_default_timezone_set($config['app.timezone']);
     mb_internal_encoding('UTF-8');
 }
开发者ID:dedesite,项目名称:illuminato,代码行数:28,代码来源:LoadConfiguration.php


注:本文中的Illuminate\Contracts\Foundation\Application::instance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。