Skip to content

Instantly share code, notes, and snippets.

@rafops
Created August 31, 2012 10:53
Show Gist options
  • Save rafops/3551415 to your computer and use it in GitHub Desktop.
Save rafops/3551415 to your computer and use it in GitHub Desktop.
Loading ini on Zend's index.php
<?php
// Define path to application directory
defined('APPLICATION_PATH')
|| define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));
// Define path to vendor directory
defined('VENDOR_PATH')
|| define('VENDOR_PATH', realpath(dirname(__FILE__) . '/../vendor'));
// Define application environment
defined('APPLICATION_ENV')
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));
// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
realpath(APPLICATION_PATH . '/../library'),
get_include_path(),
)));
/** Zend_Application */
require_once 'Zend/Application.php';
/** Composer autoload */
require_once VENDOR_PATH . '/autoload.php';
// Create application, bootstrap, and run
$application = new Zend_Application(
APPLICATION_ENV,
APPLICATION_PATH . '/configs/application.ini'
);
// Google config
$google = new Zend_Config_Ini(APPLICATION_PATH . '/configs/google.ini', APPLICATION_ENV);
Zend_Registry::set('google', $google);
// Authorization config
$authorization = new Zend_Config_Ini(APPLICATION_PATH . '/configs/authorization.ini', APPLICATION_ENV);
Zend_Registry::set('authorization', $authorization);
$application->bootstrap()
->run();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment