https://www.dobusarai.net/contact/
repository https://bitbucket.org/dobusarai/phalcon-micro-mailform/
Phalconは常にToolsのcreate-project --type simpleで作っていたのだが、Controller無しのmicroで今回は書いた。CSRF周りはControllerにあるのだけど、今回はPhalcon\Security\Random()使って自前。問題はないはず。FormActionの隠蔽などもちょっとだけ考えた。
view以外はほとんどここ。
https://bitbucket.org/dobusarai/phalcon-micro-mailform/src/master/app/app.php
一点めんどくさかったのはToolsでの雛形作成で、volt使うって指定しても使わねえでやんの。
※追記 : PhalconToolsのVersion上げれば直ってるのかも
# phalcon create-project hogefuga --type=micro --template-engine=volt
serviceのviewの部分でregisterEnginesを追記する。
https://bitbucket.org/dobusarai/phalcon-micro-mailform/src/master/app/config/services.php
/**
* Sets the view component
*/
$di->setShared('view', function () {
$config = $this->getConfig();
$view = new View();
$view->setViewsDir($config->application->viewsDir);
// use volt engine
$view->registerEngines([
'.volt' => function($view){
$config = $this->getConfig();
$volt = new VoltEngine($view, $this);
$volt->setOptions([
'compiledPath' => $config->application->cacheDir,
'compiledSeparator' => '_',
'compileAlways' => false
]);
return $volt;
}
]);
return $view;
});