EthnaとSmarty2系とcomposer create-project で Hello world
私の大切なEthna処女がやぶられた瞬間をお届けします。
composer create-project ethna/ethna-project -s dev {ProjectName}
で思わずデフォルトEnterしてしまったので、Smarty2のためにcomposer.jsonをちょこっと書き換え
{ "name": "ethna/ethna-project", "description": "Ethna project", "license": "BSD-License", "authors": [ { "name": "chobie", "email": "chobieeee@php.net", "role" : "Developer"}, { "name": "withgod", "email": "noname@withgod.jp", "role" : "Developer"}, { "name": "ethna contributors", "homepage": "https://github.com/ethna/ethna/blob/master/AUTHORS" } ], "minimum-stability": "dev", "repositories": [ { "type": "package", "package": { "name": "smarty/smarty", "version": "2.6.28", "dist": { "url": "http://www.smarty.net/files/Smarty-2.6.28.zip", "type": "zip" } } } ], "require": { "php": ">=5.3.3", "ethna/ethna-composer-handler": "*", "ethna/ethna": "*", "smarty/smarty": "2.6.*" }, "scripts": { "post-install-cmd": [ "Ethna\\ComposerHandler\\ScriptHandler::buildProject" ] }, "extra": { "ethna-app-name": "example" } }
でcomposer update
app/{ProjectName}_Controller.phpに以下を追加(Configのアプローチ間違ってるかも)
public function getConfig() { $config = parent::getConfig(); $config->set('renderer', [ 'smarty' => [ 'path' => dirname(__DIR__).'/vendor/smarty/smarty/libs/Smarty.class.php' ] ]); return $config; }
そしてcli-serverで確認php -S localhost:8888 -t www
こんにちワン、世界