1
最近我發現可以使用composer
安裝Zend Framework 1(ZF1),所以我做了一個:composer require zendframework/zendframework1
。通過添加我composer.json
改變如下:如何通過作曲者安裝Zend Framework 1?
{
...
"autoload": {
"psr-0": { "": ["application/models", "application/controllers", "application/forms"]},
"psr-4": { "": ["src/", "library/"]}
},
"require": {
...
"zendframework/zendframework1": "^1.12"
}
}
運行命令composer update
和composer dump-autoload
我看着作曲家生成的文件後,我可以看到以下內容:
/vendor/composer/autoload_files.php
===================================
// autoload_files.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
'92c8763cd6170fce6fcfe7e26b4e8c10' => $vendorDir . '/symfony/phpunit-bridge/bootstrap.php',
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php',
'c964ee0ededf28c96ebd9db5099ef910' => $vendorDir . '/guzzlehttp/promises/src/functions_include.php',
'a0edc8309cc5e1d60e3047b5df6b7052' => $vendorDir . '/guzzlehttp/psr7/src/functions_include.php',
'2c102faa651ef8ea5874edb585946bce' => $vendorDir . '/swiftmailer/swiftmailer/lib/swift_required.php',
'b067bc7112e384b61c701452d53a14a8' => $vendorDir . '/mtdowling/jmespath.php/src/JmesPath.php',
'37a3dc5111fe8f707ab4c132ef1dbc62' => $vendorDir . '/guzzlehttp/guzzle/src/functions_include.php',
'8a9dc1de0ca7e01f3e08231539562f61' => $vendorDir . '/aws/aws-sdk-php/src/functions.php',
'5255c38a0faeba867671b61dfda6d864' => $vendorDir . '/paragonie/random_compat/lib/random.php',
'023d27dca8066ef29e6739335ea73bad' => $vendorDir . '/symfony/polyfill-php70/bootstrap.php',
'bd9634f2d41831496de0d3dfe4c94881' => $vendorDir . '/symfony/polyfill-php56/bootstrap.php',
'6a47392539ca2329373e0d33e1dba053' => $vendorDir . '/symfony/polyfill-intl-icu/bootstrap.php',
'32dcc8afd4335739640db7d200c1971d' => $vendorDir . '/symfony/polyfill-apcu/bootstrap.php',
'3a37ebac017bc098e9a86b35401e7a68' => $vendorDir . '/mongodb/mongodb/src/functions.php',
);
/vendor/composer/autoload_namespaces.php
===================================
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
'Zend_' => array($vendorDir . '/zendframework/zendframework1/library'),
'Twig_' => array($vendorDir . '/twig/twig/lib'),
'SensioLabs\\Security' => array($vendorDir . '/sensiolabs/security-checker'),
'Doctrine\\ORM\\' => array($vendorDir . '/doctrine/orm/lib'),
'Doctrine\\DBAL\\' => array($vendorDir . '/doctrine/dbal/lib'),
'Doctrine\\Common\\Lexer\\' => array($vendorDir . '/doctrine/lexer/lib'),
'Doctrine\\Common\\Inflector\\' => array($vendorDir . '/doctrine/inflector/lib'),
'Doctrine\\Common\\Collections\\' => array($vendorDir . '/doctrine/collections/lib'),
'' => array($baseDir . '/application/models', $baseDir . '/application/controllers', $baseDir . '/application/forms'),
);
/vendor/composer/include_paths.php
===================================
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
$vendorDir . '/zendframework/zendframework1/library',
);
我想使用,然後該類從application/bootstrap.php
文件,例如:
use Zend_Config_Ini;
$config = new Zend_Config_Ini('./../config/config.ini', 'general');
但PHP與下面的抱怨錯誤:
PHP Fatal error: Uncaught Error: Class 'Zend_Config_Ini' not found in /var/www/html/application/bootstrap.php:23
爲什麼?我在這裏錯過了什麼?
還有一個配置包https://packagist.org/packages/zendframework/zend-config是否有可能你需要這個,而這個類不在你的配置中? – Stony