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


PHP Slim::setName方法代码示例

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


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

示例1: getSlimInstance

 public function getSlimInstance()
 {
     $slim = new Slim(array('version' => '0.0.0', 'debug' => false, 'mode' => 'testing'));
     // force to overwrite the App singleton, so that \Slim\Slim::getInstance()
     // returns the correct instance.
     $slim->setName('default');
     // make sure we don't use a caching router
     $slim->router = new NoCacheRouter($slim->router);
     return $slim;
 }
开发者ID:adbre,项目名称:slim-test-helpers,代码行数:10,代码来源:WebTestCase.php

示例2: Slim

use EcholinkSys\System;
use Monolog\Handler\StreamHandler;
use Monolog\Logger;
use Slim\Middleware\SessionCookie;
use Slim\Slim;
use Slim\Views\Twig;
use Slim\Views\TwigExtension;
require './vendor/autoload.php';
define("masterPassword", "heslo456", true);
define("host", "localhost", true);
define("username", "name", true);
define("password", "pass", true);
define("database", "dbname", true);
$app = new Slim(array('templates.path' => './twig', 'mode' => 'development'));
$app->setName('Echolink CRON System');
$app->add(new SessionCookie(array('expires' => '20 minutes', 'path' => '/', 'domain' => null, 'secure' => false, 'httponly' => false, 'name' => 'slim_session', 'secret' => 'CHANGE_ME', 'cipher' => MCRYPT_RIJNDAEL_256, 'cipher_mode' => MCRYPT_MODE_CBC)));
$app->container->singleton('log', function () {
    $log = new Logger('Echolink CRON System');
    $log->pushHandler(new StreamHandler('./logs/app.log', Logger::DEBUG));
    return $log;
});
// Prepare view
$app->view(new Twig());
$app->view->parserOptions = array('charset' => 'utf-8', 'cache' => realpath('./templates/cache'), 'auto_reload' => true, 'strict_variables' => false, 'autoescape' => true);
$app->view->parserExtensions = array(new TwigExtension());
// dashboard
$app->get('/', function () use($app) {
    $app->log->info("Echolink CRON System - '/' route");
    $echolinksys = new System("mysql:host=" . host . ";dbname=" . database, username, password);
    $dataHistory = $echolinksys->getHistoryLog();
开发者ID:ok2uec,项目名称:echolink-cron-system,代码行数:30,代码来源:index.php

示例3: Slim

 * loading of the .env files on each
 * request.
 */
if (env('SLIM_MODE', 'development') === 'development') {
    (new Dotenv\Dotenv(ROOT_PATH))->load();
}
/**
 * Create a new Slim application.
 *
 * @var Slim
 */
$app = new Slim(getconfig('slim'));
/**
 * Set the name of the Slim application.
 */
$app->setName($app->config('name'));
/**
 * Load all the active modules.
 */
$modules = glob(MODULES_PATH . '*.active.php');
foreach ($modules as $module) {
    require_once $module;
}
/**
 * Handle the application services.
 */
require_once 'services.php';
/**
 * Handle the application middleware.
 */
require_once 'middleware.php';
开发者ID:barticusprime,项目名称:slim-kit,代码行数:31,代码来源:start.php

示例4: realpath

use JeremyKendall\Password\PasswordValidator;
use JeremyKendall\Slim\Auth\Adapter\Db\PdoAdapter;
use JeremyKendall\Slim\Auth\Bootstrap;
use greboid\holidays\Acl;
use greboid\holidays\Periods;
use greboid\holidays\Allowances;
use greboid\holidays\DebugAdapter;
use Slim\Slim;
use Slim\Views\Twig;
use Slim\Views\TwigExtension;
define('APP_PATH', realpath(dirname(__DIR__)));
$roles = array('admin', 'employee', 'guest');
$app = new Slim(array('view' => new Twig()));
$app->config('debug', false);
$app->config('templates.path', '../templates');
$app->setName('Holidays');
$app->container->singleton('db', function () {
    $database = new PDO("sqlite:" . APP_PATH . "../databases/database.sqlite");
    checkAndInitDatabase($database);
    return $database;
});
$app->container->singleton('periods', function () use($app) {
    return new Periods($app->db);
});
$app->container->singleton('allowances', function () use($app) {
    return new Allowances($app->db);
});
$view = $app->view();
$app->configureMode('production', function () use($app, $view) {
    (new Bootstrap($app, new PdoAdapter($app->db, 'users', 'user', 'hash', new PasswordValidator()), new acl()))->bootstrap();
    $app->config(array('log.enable' => true, 'templates.path' => '../templates', 'debug' => false));
开发者ID:greboid,项目名称:Holidays,代码行数:31,代码来源:index.php

示例5: define

<?php

/**
 * Blueridge
 *
 * @copyright Ninelabs 2013
 * @author Moses Ngone <moses@ninelabs.com>
 */
include "/var/www/env.php";
// Set Constants
defined('APPLICATION_ROOT') || define('APPLICATION_ROOT', realpath(dirname(__FILE__) . '/../'));
defined('APP_PATH') || define('APP_PATH', APPLICATION_ROOT . '/app');
defined('API_PATH') || define('API_PATH', APPLICATION_ROOT . '/api');
defined('BIN_PATH') || define('BIN_PATH', APPLICATION_ROOT . '/bin');
defined('CACHE_DIR') || define('CACHE_DIR', APPLICATION_ROOT . '/cache');
require APPLICATION_ROOT . '/vendor/autoload.php';
use Slim\Slim;
use Slim\Views;
use Slim\Middleware\SessionCookie;
use Blueridge\Application;
use Blueridge\Middleware\Authentication;
use Blueridge\Middleware\View;
$blueridge = new Application();
$app = new Slim($blueridge['configs']['app']);
$app->setName('blueridgeapp');
$app->add(new View());
$app->add(new Authentication($blueridge));
require APP_PATH . "/init.php";
require API_PATH . "/init.php";
$app->run();
开发者ID:bigset1,项目名称:blueridge,代码行数:30,代码来源:index.php

示例6: Slim

<?php

/**
 * Piwik - Open source web analytics
 *
 * @link http://piwik.org
 * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
 */
require '../vendor/autoload.php';
if (file_exists('../config/local.php')) {
    require '../config/local.php';
}
require '../config/app.php';
use Slim\Slim;
use Slim\Views\Twig;
use helpers\Log;
use helpers\CacheMiddleware;
// New Slim App
$app = new Slim(array('view' => new Twig(), 'log.enabled' => true, 'debug' => DEBUG, 'templates.path' => '../templates', 'templates.cache' => realpath('../tmp/templates'), 'templates.charset' => 'utf-8', 'templates.auto_reload' => true, 'templates.autoescape' => true, 'log.writer' => new \Slim\Extras\Log\DateTimeFileWriter(array('path' => realpath('../tmp/logs'), 'name_format' => 'Y-m-d'))));
$app->add(new CacheMiddleware());
$app->error(function (\Exception $e) use($app) {
    Log::error('An unhandled exception occurred: ' . $e->getMessage() . $e->getTraceAsString());
    $app->response()->status(500);
});
$app->setName('developer.piwik.org');
$log = $app->getLog();
$log->setEnabled(true);
require '../routes/page.php';
$app->run();
开发者ID:ashleighpearson,项目名称:developer-documentation,代码行数:29,代码来源:index.php

示例7: Slim

<?php

chdir(__DIR__);
require 'vendor/autoload.php';
use Slim\Slim;
$app = new Slim(require 'config/app.config.php');
$app->setName('Échale Gas');
require 'resources/app.php';
require 'routes/app.php';
开发者ID:comphppuebla,项目名称:echale-gas-app,代码行数:9,代码来源:application.php

示例8: Slim

|
| The next thing we will do, is create a DB connection via RedBean.
|
*/
require ROOT . '/app/dbloader.php';
/*
|--------------------------------------------------------------------------
| Create Slim Application
|--------------------------------------------------------------------------
|
| Now, we will create a new Slim application instance
| which serves as the "glue" for all the components of this web-application.
|
*/
$app = new Slim(require_once ROOT . '/app/config/app.php');
$app->setName('RedSlim');
/*
 * set some globally available view-data
 */
$resourceUri = $_SERVER['REQUEST_URI'];
$rootUri = $app->request()->getRootUri();
$assetUri = $rootUri;
$app->view()->appendData(array('app' => $app, 'rootUri' => $rootUri, 'assetUri' => $assetUri, 'resourceUri' => $resourceUri));
// include all controllers
foreach (glob(ROOT . '/app/controllers/*.php') as $router) {
    include $router;
}
// disable fluid mode in production environment
$app->configureMode(SLIM_MODE_PRO, function () use($app) {
    // note, transactions will be auto-committed in fluid mode
    R::freeze(true);
开发者ID:voku,项目名称:anti-xss--demo,代码行数:31,代码来源:start.php


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