<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-5686566953211058816</id><updated>2024-09-08T15:18:31.027+09:00</updated><category term="php"/><category term="symfony"/><category term="Phar"/><category term="Silex"/><category term="Symfony2"/><category term="introduction"/><title type='text'>Masao Maeda&#39;s Blog</title><subtitle type='html'>about Web development like PHP, symfony, CakePHP... and so on.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://pugi-pogi.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5686566953211058816/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://pugi-pogi.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>brtriver</name><uri>http://www.blogger.com/profile/18186582962875019152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMW2QYYH7n_40fs8Z_qtK7RlBnXUfrife8JNlyPg6tYmqZczOVhovI3VZ9S5q1nMKlWeWY_Gl3ylsxKNLtsNYKdL56nfXSOSemCeg6_8h3QtJobYGCFjStezaKS1qoEA/s220/nya.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>12</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-5686566953211058816.post-4924951836459054145</id><published>2011-05-22T02:32:00.007+09:00</published><updated>2011-05-22T02:44:50.019+09:00</updated><title type='text'>Customize the route compiler for Silex</title><content type='html'>Do you know &lt;a href=&quot;http://flask.pocoo.org/&quot;&gt;Flask&lt;/a&gt; which is a microframework for Python. It looks like Silex and sinatora.&lt;br /&gt;
It allows you to use &lt;a href=&quot;http://flask.pocoo.org/docs/quickstart/#routing&quot;&gt;&#39;Variable Rules&#39;&lt;/a&gt;. This is like below:&lt;br /&gt;
&lt;br /&gt;
&lt;pre name=&quot;code&quot; class=&quot;python&quot;&gt;@app.route(&#39;/post/&amp;lt;int:post_id&amp;gt;&#39;)
def show_post(post_id):
    # show the post with the given id, the id is an integer
    pass
&lt;/pre&gt;&lt;br /&gt;
You can add the rule for each parameters, which are &quot;int:&quot;, &quot;float:&quot; or &quot;path:&quot;.&lt;br /&gt;
If you add &quot;int:&quot;, this route accepts only integers and you add &quot;path:&quot;, it is like the default but also accepts slashes.&lt;br /&gt;
you can implement by an assert method on Silex. Here is an example:&lt;br /&gt;
&lt;br /&gt;
&lt;pre name=&quot;code&quot; class=&quot;php&quot;&gt;$app-&gt;get(&#39;/post/{post_id}&#39;, function ($post_id) {
    ...
})
-&gt;assert(&#39;post_id&#39;, &#39;\d+&#39;)
&lt;/pre&gt;&lt;br /&gt;
You can see details in &lt;a href=&quot;http://silex-project.org/doc/usage.html#requirements&quot;&gt;Requirements section of the document&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
So I tried to implement it on the route of Silex. You can get the source code from &lt;a href=&quot;https://github.com/brtriver/Silex/tree/route-assert&quot;&gt;my github branch&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
If you use this version, you can write like this:&lt;br /&gt;
&lt;br /&gt;
&lt;pre name=&quot;code&quot; class=&quot;php&quot;&gt;$app = new Silex\Application();
$app[&#39;route.compiler_class&#39;] = &#39;Silex\\RouteAssertCompiler&#39;;

$app-&gt;get(&#39;/foo/{int:id}/{path:name}&#39;, function ($id, $name) {
    return sprintf(&quot;%d:%s&quot;, $id, $name);
});
&lt;/pre&gt;&lt;br /&gt;
I wrote a new RouteCompiler class, which is &quot;RouteAssertCompiler&quot; class and customized Application class which could load this new compiler class. So you have only to do is to set &#39;Silex\\RouteAssertCompiler&#39; as &#39;route.compiler_class&#39;.&lt;br /&gt;
&lt;br /&gt;
If you access &quot;/foo/3/a/b/c&quot;, this app returns &quot;3:a/b/c&quot; and if you access &quot;/foo/a/b/c&quot;, then this route does not match.&lt;br /&gt;
&lt;br /&gt;
I think this is simple and like it, but Silex has an assert method which is much flexible :)</content><link rel='replies' type='application/atom+xml' href='http://pugi-pogi.blogspot.com/feeds/4924951836459054145/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://pugi-pogi.blogspot.com/2011/05/custmize-route-compiler-for-silex.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5686566953211058816/posts/default/4924951836459054145'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5686566953211058816/posts/default/4924951836459054145'/><link rel='alternate' type='text/html' href='http://pugi-pogi.blogspot.com/2011/05/custmize-route-compiler-for-silex.html' title='Customize the route compiler for Silex'/><author><name>brtriver</name><uri>http://www.blogger.com/profile/18186582962875019152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMW2QYYH7n_40fs8Z_qtK7RlBnXUfrife8JNlyPg6tYmqZczOVhovI3VZ9S5q1nMKlWeWY_Gl3ylsxKNLtsNYKdL56nfXSOSemCeg6_8h3QtJobYGCFjStezaKS1qoEA/s220/nya.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5686566953211058816.post-8809415646849943898</id><published>2011-04-09T13:38:00.004+09:00</published><updated>2011-04-11T17:02:49.650+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Phar"/><category scheme="http://www.blogger.com/atom/ns#" term="Silex"/><title type='text'>If your Phar doesn&#39;t work well ...</title><content type='html'>Do you know Phar extension? Here is a introduction in PHP official manual below:&lt;br /&gt;
&lt;blockquote&gt;What is phar? Phar archives are best characterized as a convenient way to group several files into a single file. As such, a phar archive provides a way to distribute a complete PHP application in a single file and run it from that file without the need to extract it to disk. Additionally, phar archives can be executed by PHP as easily as any other file, both on the commandline and from a web server. Phar is kind of like a thumb drive for PHP applications. (via. &lt;a href=&quot;http://jp.php.net/manual/en/intro.phar.php&quot;&gt;http://jp.php.net/manual/en/intro.phar.php&lt;/a&gt;)&lt;/blockquote&gt;&lt;br /&gt;
Phar requires PHP 5.2.0 or newer. If your PHP is PHP 5.3, the Phar extension is build into PHP in default, otherwise Phar may be installed via the PECL extension with previous PHP versions.&lt;br /&gt;
If your Phar doesn&#39;t work well after you installed; the error has occured and so on, you have to check your php configure below.&lt;br /&gt;
&lt;h3&gt;check configure options&lt;/h3&gt;If you installed or compiled php with &quot;--enable-zend-multibyte&quot; option, Phar doesn&#39;t work well. So you have to recompile your php without &quot;--enable-zend-multibyte&quot;.&lt;br /&gt;
For example, you installed php with brew, you have to modify your file.&lt;br /&gt;
&lt;br /&gt;
Launch your text editor, and comment out the &quot;--enable-zend-multivyte&quot; line and save it.&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;$ brew edit php&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;&quot;--enable-bcmath&quot;,&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;&quot;--enable-calendar&quot;,&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;&quot;--enable-memcache&quot;,&lt;br /&gt;
# &amp;nbsp; &amp;nbsp; &amp;nbsp;&quot;--enable-zend-multibyte&quot;,&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;&quot;--with-openssl=/usr&quot;,&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;&quot;--with-zlib=/usr&quot;,&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;&quot;--with-bz2=/usr&quot;,&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;Suhosin Phar &quot;URL not allowed&quot;&lt;/h3&gt;&lt;br /&gt;
If you use Suhosin PHP, Phar doesn&#39;t work well becase of its high security setting. So you have to check &lt;a href=&quot;http://william.shallum.net/random-notes/suhosinpharurlnotallowed&quot;&gt;here&lt;/a&gt;.&lt;br /&gt;
In addition, Kagaya Masaki mailed me how to modify the php.ini for the environment of Suhosin PHP.&lt;br /&gt;
You may have to check your php.ini and modify it:&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;detect_unicode = Off&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;suhosin.executor.include.whitelist = phar&lt;br /&gt;
&lt;br /&gt;
(via. &lt;a href=&quot;http://www.php.net/manual/ja/phar.using.intro.php#100127&quot;&gt;http://www.php.net/manual/ja/phar.using.intro.php#100127&lt;/a&gt;)&lt;br /&gt;
&lt;br /&gt;
I hope these tips will help you :)</content><link rel='replies' type='application/atom+xml' href='http://pugi-pogi.blogspot.com/feeds/8809415646849943898/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://pugi-pogi.blogspot.com/2011/04/check-your-php-if-your-phar-doesnt-work.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5686566953211058816/posts/default/8809415646849943898'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5686566953211058816/posts/default/8809415646849943898'/><link rel='alternate' type='text/html' href='http://pugi-pogi.blogspot.com/2011/04/check-your-php-if-your-phar-doesnt-work.html' title='If your Phar doesn&#39;t work well ...'/><author><name>brtriver</name><uri>http://www.blogger.com/profile/18186582962875019152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMW2QYYH7n_40fs8Z_qtK7RlBnXUfrife8JNlyPg6tYmqZczOVhovI3VZ9S5q1nMKlWeWY_Gl3ylsxKNLtsNYKdL56nfXSOSemCeg6_8h3QtJobYGCFjStezaKS1qoEA/s220/nya.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5686566953211058816.post-3610542977774754034</id><published>2011-04-09T04:51:00.003+09:00</published><updated>2011-04-11T17:02:20.934+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Phar"/><category scheme="http://www.blogger.com/atom/ns#" term="Silex"/><category scheme="http://www.blogger.com/atom/ns#" term="Symfony2"/><title type='text'>Sample Micro Application &quot;MameForm&quot; which is made by Sliex</title><content type='html'>Silex is a microframework written in PHP. It&#39;s inspired by sinatora. You have only to do is to require silex.phar!&lt;br /&gt;
&lt;br /&gt;
A new official web site of &lt;a href=&quot;http://silex-project.org/&quot;&gt;Silex&lt;/a&gt; has been published, so I tried to create a sample application with it.&lt;br /&gt;
&lt;br /&gt;
&lt;img src=&quot;http://cdn-ak.f.st-hatena.com/images/fotolife/b/brtRiver/20110406/20110406181741.png&quot; /&gt;&lt;br /&gt;
&lt;br /&gt;
At this time, I decided to create a simple contact form application with it. there are 2 screens, entry and complete one. when users complete, an email will be sent to the administration.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;Phar&lt;/h3&gt;&lt;br /&gt;
&lt;br /&gt;
[Notice] If your PHP is compiled with &quot;--enable-zend-multibyte&quot;, Phar doesn&#39;t work. Check your compile option.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;Install MameForm&lt;/h3&gt;&lt;br /&gt;
&lt;br /&gt;
On the official site, you can read the detail documentation about Silex.&lt;br /&gt;
&lt;br /&gt;
Now you can get my sample application code by &lt;a href=&quot;https://github.com/brtriver/MameForm&quot;&gt;my git repository&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;$ git clone git://github.com/brtriver/MameForm.git ./MameForm&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;$ cd ./MameForm&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;$ git submodule init&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;$ git submodule update&lt;br /&gt;
&lt;br /&gt;
This sample application use Twig for a template engine and SwiftMailer4 for sending emails, so you have to call submodule init and update.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;Structure of MameForm&lt;/h3&gt;&lt;br /&gt;
&lt;br /&gt;
The structure of MameForm is very simple because of phar archive.&lt;br /&gt;
index.php file is a front controller file and which we write logics code in.&lt;br /&gt;
&quot;views&quot; directory is to set twig templates, in this application, only 4 templates are set: base.twig (layout), entry.twig, complete.twig and mail.twig(used for mail body).&lt;br /&gt;
&lt;br /&gt;
There are some .htaccess files to deny to access this directory directly.&lt;br /&gt;
&lt;br /&gt;
&lt;img src=&quot;http://cdn-ak.f.st-hatena.com/images/fotolife/b/brtRiver/20110406/20110406181802.png&quot; /&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;Call the application&lt;/h3&gt;&lt;br /&gt;
&lt;br /&gt;
simple call&lt;br /&gt;
&lt;br /&gt;
Then we read index.php.&lt;br /&gt;
It is very simple to use Silex. You have only to write below:&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;require __DIR__.&#39;/silex.phar&#39;;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;use Silex\Application;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;$app = new Application();&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;....&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;$app-&amp;gt;run();&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;Entry Page&lt;/h3&gt;&lt;br /&gt;
&lt;br /&gt;
If you install MameForm in your local environment, you can see below with accessing like &quot;http://localhost/MameForm&quot;&lt;br /&gt;
&lt;br /&gt;
&lt;img src=&quot;http://cdn-ak.f.st-hatena.com/images/fotolife/b/brtRiver/20110406/20110406182132.png&quot; /&gt;&lt;br /&gt;
&lt;br /&gt;
Then let&#39;s see the code to be execused in index.php&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;...&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;// entry&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;$app-&amp;gt;get(&#39;/&#39;, function() use ($app) {&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return $app[&#39;twig&#39;]-&amp;gt;render(&#39;entry.twig&#39;, array());&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;});&lt;br /&gt;
&lt;br /&gt;
Silex helps us to write easily. If the request method is &quot;GET&quot;, $app-&amp;gt;get method is called and because of our using anonymouse function, this code is very readability.&lt;br /&gt;
In this code, there is no logic in it: you have only to return the results which is rendered by Twig.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;Validation&lt;/h3&gt;&lt;br /&gt;
&lt;br /&gt;
Silex has no library or extention to validate, so this time, I wrote the code in index.php below: It&#39;s not best way to write validation code in index.php directly, if you always use Silex, You have to prepare your validation library with a Silex extention.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;...&lt;br /&gt;
&amp;nbsp;&amp;nbsp;// send email&lt;br /&gt;
&amp;nbsp;&amp;nbsp;$app-&amp;gt;post(&#39;/&#39;, function() use ($app) {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;// validate&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;$errors = array();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;// check empty&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;foreach (array(&#39;name&#39;, &#39;email&#39;, &#39;message&#39;) as $k) {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;if (trim($app[&#39;request&#39;]-&amp;gt;get($k)) === &quot;&quot;) {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;$errors[] = sprintf(&quot;%s is required.&quot;, $k);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;// check email&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;if (!filter_var($app[&#39;request&#39;]-&amp;gt;get(&#39;email&#39;), FILTER_VALIDATE_EMAIL)) {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;$errors[] = sprintf(&quot;email is not valid.&quot;);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;// send email&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;if (count($errors) === 0) {&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//after sending email, redirect to complete page.&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;return $app[&#39;twig&#39;]-&amp;gt;render(&#39;entry.twig&#39;, compact(&#39;errors&#39;));&lt;br /&gt;
&amp;nbsp;&amp;nbsp;});&lt;br /&gt;
&lt;br /&gt;
If the request method is &quot;POST&quot; and access to &quot;/&quot;, $app-&amp;gt;post(&quot;/&quot;) method is called. If errors are occured, an error message pushed to the $errors array. It&#39;s simple.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;Before Filter&lt;/h3&gt;&lt;br /&gt;
&lt;br /&gt;
I want to use request parameters in templates. in default, we can access to &quot;{{app.requset.request.get(&#39;name&#39;)}}&quot; but it&#39;s not simple, so I made a shorter name for this property like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;...&lt;br /&gt;
&amp;nbsp;&amp;nbsp;// filter&lt;br /&gt;
&amp;nbsp;&amp;nbsp;$app-&amp;gt;before(function() use($app){&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;// assign request parameters to &quot;request&quot; for Twig templates with shorter name&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;$app[&#39;twig&#39;]-&amp;gt;addGlobal(&#39;request&#39;, $app[&#39;request&#39;]-&amp;gt;request);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;});&lt;br /&gt;
&lt;br /&gt;
Thanks to this fileter, I can do access to the request parameters like &quot;{{request.get(&#39;name&#39;)}}&quot;, It&#39;s very read readability.&lt;br /&gt;
&lt;br /&gt;
Finally, the template of the entry page is like below:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;{% extends &quot;base.twig&quot; %}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;{% block title %}Entry Page{% endblock %}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;{% block content %}&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp;&amp;lt;h1&amp;gt;Contact Form&amp;lt;/h1&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp;&amp;lt;ul class=&quot;error&quot;&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;{% for error in errors %}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp;&amp;lt;li&amp;gt;{{error}}&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;{% endfor %}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp;&amp;lt;div id=&quot;entryForm&quot;&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp;&amp;lt;form method=&quot;post&quot; action=&quot;{{app.request.baseUrl}}/&quot;&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt; &amp;nbsp; &amp;nbsp;&amp;lt;div id=&quot;formName&quot;&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;label for=&quot;Name&quot;&amp;gt;Name:&amp;lt;/label&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;input type=&quot;text&quot; name=&quot;name&quot; id=&quot;Name&quot; value=&quot;{{request.get(&#39;name&#39;)}}&quot;&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;div id=&quot;formEmail&quot;&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;label for=&quot;Email&quot;&amp;gt;Email:&amp;lt;/label&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;input type=&quot;text&quot; name=&quot;email&quot; id=&quot;Email&quot; value=&quot;{{request.get(&#39;email&#39;)}}&quot;&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt; &amp;nbsp; &amp;nbsp;&amp;lt;div id=&quot;formMessage&quot;&amp;gt; &lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;label for=&quot;Message&quot;&amp;gt;Message:&amp;lt;/label&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;textarea name=&quot;message&quot; rows=&quot;20&quot; cols=&quot;20&quot; id=&quot;Message&quot;&amp;gt;{{request.get(&#39;message&#39;)}}&amp;lt;/textarea&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;div&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;input type=&quot;submit&quot; name=&quot;submit&quot; value=&quot;Submit&quot; class=&quot;submit-button&quot;&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;div&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp;&amp;lt;/form&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;{% endblock %}&lt;/blockquote&gt;&lt;br /&gt;
&lt;br /&gt;
Thanks to Twig, the default params are escaped so we don&#39;t need to care of XSS.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;Send Emails&lt;/h3&gt;&lt;br /&gt;
&lt;br /&gt;
This sample code is similar to demo code in the official documentation, only in this code, we can use Twig for body content.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;...&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;// send email&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;if (count($errors) === 0) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp;$body = $app[&#39;twig&#39;]-&amp;gt;render(&#39;mail.twig&#39;); // set Twig template&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp;$message = \Swift_Message::newInstance()&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;-&amp;gt;setSubject(EMAIL_SUBJECT)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;-&amp;gt;setFrom(array($app[&#39;request&#39;]-&amp;gt;get(&#39;email&#39;)))&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;-&amp;gt;setTo(array(EMAIL_ADDRESS_FROM))&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;-&amp;gt;setBody($body);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp;$transport = \Swift_MailTransport::newInstance();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp;$mailer = \Swift_Mailer::newInstance($transport);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp;$mailer-&amp;gt;send($message);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp;return $app-&amp;gt;redirect($app[&#39;request&#39;]-&amp;gt;getBaseUrl() .&#39;/complete&#39;);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After sending a email, Silex force to redirect to the complete page. this redirect function is default method in Silex.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;Conclusion&lt;/h3&gt;&lt;br /&gt;
&lt;br /&gt;
The total line number which I had to write is only 65. I think it is very shorter than if we write plain php codes.&lt;br /&gt;
It is not difficult to add a new feature to your Silex application because of the extension and it is easy to upload your Silex application to your server by FTP because of a phar archive.&lt;br /&gt;
If you want to watch another code written by Silex, there is &lt;a href=&quot;http://sismo-project.org/&quot;&gt;Sismo&lt;/a&gt;,which is brought to you by Fabien Potenci. It&#39;s very useful to understand Silex.</content><link rel='replies' type='application/atom+xml' href='http://pugi-pogi.blogspot.com/feeds/3610542977774754034/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://pugi-pogi.blogspot.com/2011/04/create-sample-contact-form-application.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5686566953211058816/posts/default/3610542977774754034'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5686566953211058816/posts/default/3610542977774754034'/><link rel='alternate' type='text/html' href='http://pugi-pogi.blogspot.com/2011/04/create-sample-contact-form-application.html' title='Sample Micro Application &quot;MameForm&quot; which is made by Sliex'/><author><name>brtriver</name><uri>http://www.blogger.com/profile/18186582962875019152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMW2QYYH7n_40fs8Z_qtK7RlBnXUfrife8JNlyPg6tYmqZczOVhovI3VZ9S5q1nMKlWeWY_Gl3ylsxKNLtsNYKdL56nfXSOSemCeg6_8h3QtJobYGCFjStezaKS1qoEA/s220/nya.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5686566953211058816.post-2016093536487392545</id><published>2011-03-23T22:43:00.001+09:00</published><updated>2011-03-23T22:46:09.075+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="php"/><category scheme="http://www.blogger.com/atom/ns#" term="symfony"/><title type='text'>New Japanese Symfony 1.4 book has been published!</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOwz-EAAPLw_Qr7H45ntgaKtw10FceWm3RFLBZsS5wOKWjv3kh7DPvWLhD4Ewyc5sMv-6RpSA7a8EXKlM-HrZnJ7TSPh0_8CUVuw6IxJaC0CaUS4hLJtW5cAbQeP8Z6l7RcZ7E-GbkxDQq/s1600/ad14book.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;320&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOwz-EAAPLw_Qr7H45ntgaKtw10FceWm3RFLBZsS5wOKWjv3kh7DPvWLhD4Ewyc5sMv-6RpSA7a8EXKlM-HrZnJ7TSPh0_8CUVuw6IxJaC0CaUS4hLJtW5cAbQeP8Z6l7RcZ7E-GbkxDQq/s320/ad14book.jpg&quot; width=&quot;245&quot; /&gt;&lt;/a&gt;&lt;/div&gt;On March 23, a new Japanese symfony(1.4) book had been published!&lt;br /&gt;
&lt;br /&gt;
In Japan, there are a lot of technological books for PHP. but　there was no Japanese symfony book for ver 1.4.&lt;br /&gt;
Until now there were two books for ver 1.0.&lt;br /&gt;
I had written &lt;a href=&quot;http://www.amazon.co.jp/symfony%E5%BE%B9%E5%BA%95%E6%94%BB%E7%95%A5-PHP%E5%BE%B9%E5%BA%95%E6%94%BB%E7%95%A5%E3%82%B7%E3%83%AA%E3%83%BC%E3%82%BA-%E5%89%8D%E7%94%B0-%E9%9B%85%E5%A4%AE/dp/4797343052/ref=sr_1_2?ie=UTF8&amp;amp;qid=1300887344&amp;amp;sr=8-2&quot;&gt;one&lt;/a&gt; of Japanese symfony books for ver 1.0 in 2007. It&#39;s 4 years ago! Those who wanted to learn symfony and buy Japanese books always said that they couldn&#39;t buy symfony books because it&#39;s too old. I think that a lot of Japanese developers would like to buy books as well as read it online. Now People focus on Symfony2 but symfony1.4 is stable and the current Long Term Support release, so symfony 1.4 is used in a lot of projects. It&#39;s very important for developers to buy this book.&lt;br /&gt;
&lt;br /&gt;
This book has been written by members of the Japanese Symfony user group. They are specialists who use symfony in Japan. So this book includes a lot of tips in practice. We hope this book helps Japanese developers who learn and understand symfony.&lt;br /&gt;
&lt;br /&gt;
And Fabien and Stefan gave us messages for this book. Thanks a lot!&lt;br /&gt;
&lt;br /&gt;
via: &lt;a href=&quot;http://books.symfony.gr.jp/14book/index.html&quot;&gt;http://books.symfony.gr.jp/14book/index.html &lt;/a&gt;(Japanese Only)</content><link rel='replies' type='application/atom+xml' href='http://pugi-pogi.blogspot.com/feeds/2016093536487392545/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://pugi-pogi.blogspot.com/2011/03/new-japanese-symfony-14-book-has-been.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5686566953211058816/posts/default/2016093536487392545'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5686566953211058816/posts/default/2016093536487392545'/><link rel='alternate' type='text/html' href='http://pugi-pogi.blogspot.com/2011/03/new-japanese-symfony-14-book-has-been.html' title='New Japanese Symfony 1.4 book has been published!'/><author><name>brtriver</name><uri>http://www.blogger.com/profile/18186582962875019152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMW2QYYH7n_40fs8Z_qtK7RlBnXUfrife8JNlyPg6tYmqZczOVhovI3VZ9S5q1nMKlWeWY_Gl3ylsxKNLtsNYKdL56nfXSOSemCeg6_8h3QtJobYGCFjStezaKS1qoEA/s220/nya.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOwz-EAAPLw_Qr7H45ntgaKtw10FceWm3RFLBZsS5wOKWjv3kh7DPvWLhD4Ewyc5sMv-6RpSA7a8EXKlM-HrZnJ7TSPh0_8CUVuw6IxJaC0CaUS4hLJtW5cAbQeP8Z6l7RcZ7E-GbkxDQq/s72-c/ad14book.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5686566953211058816.post-4425886787175224967</id><published>2011-03-11T07:36:00.001+09:00</published><updated>2011-03-11T11:21:02.978+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="php"/><category scheme="http://www.blogger.com/atom/ns#" term="symfony"/><title type='text'>How to custmize the error page in Symfony2</title><content type='html'>We can see the new character, which name I don&#39;t know at the error page.&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://cdn-ak.f.st-hatena.com/images/fotolife/b/brtRiver/20110309/20110309051600.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;263&quot; src=&quot;http://cdn-ak.f.st-hatena.com/images/fotolife/b/brtRiver/20110309/20110309051600.png&quot; width=&quot;700&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
Speaking of the character, there is an unofficial symfony character, which name is &quot;Symfonyan&quot;.&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://clipp.jp/assets/d6/d61590457b79a3fe806d05b10bf1ca69_500.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;500&quot; src=&quot;http://clipp.jp/assets/d6/d61590457b79a3fe806d05b10bf1ca69_500.jpg&quot; width=&quot;428&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
Symfonyan is &quot;Symfony&quot; + &quot;Nayn&quot;. &quot;Nyan&quot; is Japanese which mean mew. She is pretty :D&lt;br /&gt;
&lt;br /&gt;
So, I tried to change the character to Symfonyan in this error page.&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;How to customize the error page&lt;/h2&gt;&lt;br /&gt;
At the first, I read the documentation &lt;a href=&quot;http://symfony.com/doc/2.0/cookbook/controller/error_pages.html&quot; target=&quot;_blank&quot;&gt;Symfony - How to customize Error Pages&lt;/a&gt;. But I could not custmize it! Perhaps the path where we put the customized html is changed in PR7. So I read the source code and I saw the correct path.&lt;br /&gt;
&lt;br /&gt;
So I decided to make an original bundle, &quot;SymfonyanBundle&quot; because of making everyone use it easily.&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;How to install SymfonyanBundle&lt;/h2&gt;&lt;br /&gt;
the source code of &lt;a href=&quot;https://github.com/brtriver/SymfonyanBundle&quot;&gt;SymfonyanBundle&lt;/a&gt; is managed in Github. So you can install it by git command.&lt;br /&gt;
&lt;blockquote&gt;$ git clone git://github.com/brtriver/SymfonyanBundle.git src/Acme/SymfonyanBundle&lt;/blockquote&gt;&lt;br /&gt;
You have to add this bundle in app/AppKernel.php&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;....&lt;br /&gt;
if (in_array($this-&amp;gt;getEnvironment(), array(&#39;dev&#39;, &#39;test&#39;))) {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; $bundles[] = new Symfony\Bundle\WebConfiguratorBundle\SymfonyWebConfiguratorBundle();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; $bundles[] = new Acme\DemoBundle\AcmeDemoBundle();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; $bundles[] = new Acme\SymfonyanBundle\SymfonyanBundle(); // &amp;lt;= addition &lt;/blockquote&gt;&lt;blockquote&gt;} &lt;/blockquote&gt;&lt;br /&gt;
&lt;br /&gt;
Confirm by the console. If you can add this bundle, you can see like below.&lt;br /&gt;
&lt;blockquote&gt;$ ./app/console&lt;br /&gt;
...&lt;br /&gt;
symfonyan&lt;br /&gt;
:exception-install           Change the icon of the exception page to Symfonyan&lt;br /&gt;
:welcome-install             Change the welcome page to Symfonyan&lt;/blockquote&gt;&lt;br /&gt;
At the last, you have only to run this command from console. It&#39;s very simple and easy!&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;$ ./app/console symfonyan:exception-install --symlink&lt;br /&gt;
$ ./app/console assets:install web --symlink&lt;/blockquote&gt;&lt;br /&gt;
&lt;h2&gt;Result&lt;/h2&gt;&lt;br /&gt;
[404 in development env]&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://cdn-ak.f.st-hatena.com/images/fotolife/b/brtRiver/20110309/20110309051601.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;274&quot; src=&quot;http://cdn-ak.f.st-hatena.com/images/fotolife/b/brtRiver/20110309/20110309051601.png&quot; width=&quot;700&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
[404 in production env]&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://cdn-ak.f.st-hatena.com/images/fotolife/b/brtRiver/20110309/20110309051603.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;130&quot; src=&quot;http://cdn-ak.f.st-hatena.com/images/fotolife/b/brtRiver/20110309/20110309051603.png&quot; width=&quot;700&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
cute!&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;One more thing&lt;/h2&gt;You can customize the default welcome page with Symfonyan. It&#39;s easy to run the command below.&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;$ ./app/console symfonyan:welcome-install --symlink&lt;/blockquote&gt;The default page is translated to Japanese, too :) &lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://cdn-ak.f.st-hatena.com/images/fotolife/b/brtRiver/20110309/20110309192439.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;http://cdn-ak.f.st-hatena.com/images/fotolife/b/brtRiver/20110309/20110309192439.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://pugi-pogi.blogspot.com/feeds/4425886787175224967/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://pugi-pogi.blogspot.com/2011/03/how-to-custmize-error-page-in-symfony2.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5686566953211058816/posts/default/4425886787175224967'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5686566953211058816/posts/default/4425886787175224967'/><link rel='alternate' type='text/html' href='http://pugi-pogi.blogspot.com/2011/03/how-to-custmize-error-page-in-symfony2.html' title='How to custmize the error page in Symfony2'/><author><name>brtriver</name><uri>http://www.blogger.com/profile/18186582962875019152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMW2QYYH7n_40fs8Z_qtK7RlBnXUfrife8JNlyPg6tYmqZczOVhovI3VZ9S5q1nMKlWeWY_Gl3ylsxKNLtsNYKdL56nfXSOSemCeg6_8h3QtJobYGCFjStezaKS1qoEA/s220/nya.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5686566953211058816.post-3672999351383737555</id><published>2010-10-06T16:01:00.002+09:00</published><updated>2010-10-06T16:11:57.556+09:00</updated><title type='text'>Thank you for PHPMatsuri!</title><content type='html'>&lt;a href=&quot;http://2010.phpmatsuri.net/page/what-is-php-matsuri&quot;&gt;PHPMatsuri&lt;/a&gt; 2010 took place on October 2nd and 3rd in Japan.&lt;br /&gt;
I took part in this event so I wrote my impression about it with not only tweeting but writing my blog.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.flickr.com/search/?ss=2&amp;w=all&amp;q=phpmatsuri&amp;m=text&quot;&gt;You can look at the pictures at flicker&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
This event let me give a lot of things for just two days.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Workshop with core developers&lt;/b&gt;&lt;br /&gt;
In this event, the workshops of CakePHP, Lithium and Symfony2 were held on the afternoon of the first day.&lt;br /&gt;
Each core developer was the teacher of the workshop!&lt;br /&gt;
&lt;br /&gt;
I have just been able to join the Symfony2 workshop. In this workshop, Kris Wallsmith showed us how to create an application, which is like a twitter with Symfony2 and Doctrine2.&lt;br /&gt;
It&#39;s very awesome!&lt;br /&gt;
&lt;br /&gt;
We had seen how to solve when errors had occurred on the way to write codes and how to use the filter function of Textmate when searching the Doctrine methods.&lt;br /&gt;
And I was surprised that his typing of namespaces was too fast!&lt;br /&gt;
&lt;br /&gt;
This workshop was in English at first, but thanks for &lt;a href=&quot;http://twitter.com/mackstar&quot;&gt;@mackstar&lt;/a&gt; interpreting, we could communicated with each other.&lt;br /&gt;
And I thought it great that all participants would make a noble effort to understand by English and &lt;a href=&quot;http://twitter.com/hidenorigoto&quot;&gt;@hidenorigoto&lt;/a&gt; tried to ask him in English.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;English or Die&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://twitter.com/hyoshiok&quot;&gt;@hyoshiok&lt;/a&gt; told us that English is very important for Japanese developers. I think so too and I felt it in this event indeed.&lt;br /&gt;
I think my English is not enough to communicate with others.&lt;br /&gt;
At symfony meet up Tokyo last year, I could hardly told with Fabien in English.&lt;br /&gt;
So, when I would decide to participate this event, I started to study English on my way to my office and join an English speaking society.&lt;br /&gt;
At the results, I think my English is still poor now but I could communicate a little with core developers, Nate, Joel, Graham and Kris.&lt;br /&gt;
&lt;br /&gt;
At this time, as I tried to use Lithium and MongoDB to create an web service, I was very happy that I could ask a question to Nate and Joel directly.&lt;br /&gt;
&lt;br /&gt;
From now, I would try to participate the conference abroad and send much information in English :-)&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Sukonv?&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
I am developing an web service, Sukonv. It is a project with &lt;a href=&quot;http://twitter.com/hidenorigoto&quot;&gt;@hidenorigoto&lt;/a&gt; and &lt;a href=&quot;http://twitter.com/cakephper&quot;&gt;@cakephper&lt;/a&gt;. And in this event, we wrote codes about this.&lt;br /&gt;
It is far from complete but We could show this application demo at the Hack Demo in the second day.&lt;br /&gt;
&lt;br /&gt;
Sukonv is a web service for developers with php frameworks. Anyone will be able to post the tips for each framework and share them or search them.&lt;br /&gt;
And I could get the prize at the Hack Demo! Thank you a lot!&lt;br /&gt;
&lt;br /&gt;
I experienced and leaned a lot from PHPMatsuri and I have recognized that I make use of this experience.&lt;br /&gt;
&lt;br /&gt;
At the last, Thanks for the staffs which use all their resources to PHPMatsuri!</content><link rel='replies' type='application/atom+xml' href='http://pugi-pogi.blogspot.com/feeds/3672999351383737555/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://pugi-pogi.blogspot.com/2010/10/thank-you-for-phpmatsuri.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5686566953211058816/posts/default/3672999351383737555'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5686566953211058816/posts/default/3672999351383737555'/><link rel='alternate' type='text/html' href='http://pugi-pogi.blogspot.com/2010/10/thank-you-for-phpmatsuri.html' title='Thank you for PHPMatsuri!'/><author><name>brtriver</name><uri>http://www.blogger.com/profile/18186582962875019152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMW2QYYH7n_40fs8Z_qtK7RlBnXUfrife8JNlyPg6tYmqZczOVhovI3VZ9S5q1nMKlWeWY_Gl3ylsxKNLtsNYKdL56nfXSOSemCeg6_8h3QtJobYGCFjStezaKS1qoEA/s220/nya.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5686566953211058816.post-56112495923134122</id><published>2010-08-02T14:56:00.000+09:00</published><updated>2010-08-02T14:56:00.114+09:00</updated><title type='text'>Shinshu Yutanaka Onsen tour to translate documentations</title><content type='html'>Last week end, I took part in the event to translate PHP framework documentations to Japanese together at the resort, Shinshu Yutanaka Onsen!&lt;br /&gt;
&lt;br /&gt;
&lt;img src=&quot;http://img.f.hatena.ne.jp/images/fotolife/b/brtRiver/20100731/20100731133251.jpg&quot;&gt;&lt;br /&gt;
&lt;br /&gt;
I translated &quot;Gentle Introduction of symfony&quot; documentations with members of Symfony Users Group, others translated about CakePHP, Zend Framework.&lt;br /&gt;
&lt;br /&gt;
for a switch, We soaked in the outdoor hot tub, Roten-buro.&lt;br /&gt;
So we talked about many things: symfony, Symfony2, CakePHP and ZendFramework.&lt;br /&gt;
&lt;br /&gt;
We had such a productive week end.</content><link rel='replies' type='application/atom+xml' href='http://pugi-pogi.blogspot.com/feeds/56112495923134122/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://pugi-pogi.blogspot.com/2010/08/shinshu-yutanaka-onsen-tour-to.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5686566953211058816/posts/default/56112495923134122'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5686566953211058816/posts/default/56112495923134122'/><link rel='alternate' type='text/html' href='http://pugi-pogi.blogspot.com/2010/08/shinshu-yutanaka-onsen-tour-to.html' title='Shinshu Yutanaka Onsen tour to translate documentations'/><author><name>brtriver</name><uri>http://www.blogger.com/profile/18186582962875019152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMW2QYYH7n_40fs8Z_qtK7RlBnXUfrife8JNlyPg6tYmqZczOVhovI3VZ9S5q1nMKlWeWY_Gl3ylsxKNLtsNYKdL56nfXSOSemCeg6_8h3QtJobYGCFjStezaKS1qoEA/s220/nya.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5686566953211058816.post-9121152371666209107</id><published>2010-06-01T13:58:00.001+09:00</published><updated>2010-06-01T13:59:26.966+09:00</updated><title type='text'>Symfony Japan web site is released!</title><content type='html'>Symfony Japan web site is released.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.symfony.gr.jp/&quot;&gt;http://www.symfony.gr.jp/&lt;/a&gt;&amp;nbsp; (Japanese only)&lt;br /&gt;
&lt;br /&gt;
This site provides symfony information and tips for Japanese symfony users in Japanese.&lt;br /&gt;
So, this site helps the spread of symfony in Japan than ever before :-)</content><link rel='replies' type='application/atom+xml' href='http://pugi-pogi.blogspot.com/feeds/9121152371666209107/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://pugi-pogi.blogspot.com/2010/06/symfony-japan-web-site-is-released.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5686566953211058816/posts/default/9121152371666209107'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5686566953211058816/posts/default/9121152371666209107'/><link rel='alternate' type='text/html' href='http://pugi-pogi.blogspot.com/2010/06/symfony-japan-web-site-is-released.html' title='Symfony Japan web site is released!'/><author><name>brtriver</name><uri>http://www.blogger.com/profile/18186582962875019152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMW2QYYH7n_40fs8Z_qtK7RlBnXUfrife8JNlyPg6tYmqZczOVhovI3VZ9S5q1nMKlWeWY_Gl3ylsxKNLtsNYKdL56nfXSOSemCeg6_8h3QtJobYGCFjStezaKS1qoEA/s220/nya.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5686566953211058816.post-7323706473244585266</id><published>2010-03-16T10:29:00.000+09:00</published><updated>2010-03-16T10:29:52.621+09:00</updated><title type='text'>update sfSimplePagePlugin</title><content type='html'>Thanks to basos, I updated sfSimplePagePlugin, which is a part of symfony plugins.&lt;br /&gt;
&lt;br /&gt;
The &lt;span class=&quot;search_hit&quot;&gt;sfSimplePage&lt;/span&gt;Plugin allows you to manage like static pages with symfony. &lt;br /&gt;
If you are stranger and interested in this plugin, you can read the overview in&amp;nbsp;&lt;a href=&quot;http://develop.ddo.jp/new-tech/php/framework/symfony/plugin/sfsimplepageplugin&quot;&gt;my page&lt;/a&gt; .&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This release allow you to use a new component which can be called from another module&#39;s template. now this plugin can be used in both sf 1.3 and sf 1.4. If you want to know about this release, please read a&amp;nbsp; &lt;a href=&quot;http://www.symfony-project.org/plugins/sfSimplePagePlugin&quot;&gt;sfSimplePagePlugin page&lt;/a&gt;.</content><link rel='replies' type='application/atom+xml' href='http://pugi-pogi.blogspot.com/feeds/7323706473244585266/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://pugi-pogi.blogspot.com/2010/03/update-sfsimplepageplugin.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5686566953211058816/posts/default/7323706473244585266'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5686566953211058816/posts/default/7323706473244585266'/><link rel='alternate' type='text/html' href='http://pugi-pogi.blogspot.com/2010/03/update-sfsimplepageplugin.html' title='update sfSimplePagePlugin'/><author><name>brtriver</name><uri>http://www.blogger.com/profile/18186582962875019152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMW2QYYH7n_40fs8Z_qtK7RlBnXUfrife8JNlyPg6tYmqZczOVhovI3VZ9S5q1nMKlWeWY_Gl3ylsxKNLtsNYKdL56nfXSOSemCeg6_8h3QtJobYGCFjStezaKS1qoEA/s220/nya.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5686566953211058816.post-4962810932312235542</id><published>2010-02-19T04:52:00.005+09:00</published><updated>2010-02-19T05:13:26.109+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="php"/><category scheme="http://www.blogger.com/atom/ns#" term="symfony"/><title type='text'>Try to customize the console script in Symfony2</title><content type='html'>Yesterday, &lt;a href=&quot;http://symfony-reloaded.org/&quot;&gt;Symfony Reloaded 2.0 Preview was released&lt;/a&gt;.&lt;br /&gt;
I have tried to use this by &lt;a href=&quot;http://github.com/noelg/symfony-demo&quot;&gt;symfony-demo&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
Symfony 2 is &lt;span class=&quot;midashi&quot;&gt;in marked contrast to symfony 1.x, for example, the amount of the directories in Root is only three: &quot;web&quot;, &quot;src&quot; and &quot;cart&quot;! How simple!&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;midashi&quot;&gt;I found &quot;console&quot; script in the cart directory. when I ran it with the &quot;--shell&quot; option in my console, &quot;Symfony 2&quot; message was displayed like below:&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://f.hatena.ne.jp/images/fotolife/b/brtRiver/20100218/20100218230504.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;http://f.hatena.ne.jp/images/fotolife/b/brtRiver/20100218/20100218230504.png&quot; /&gt;&lt;/a&gt;&amp;nbsp;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;So I tried to customize this &quot;Symfony 2&quot; message to change another one.&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;Symfony 2 is written in PHP 5.3, so each class has &quot;namespace&quot;. I copied the files to change from the Symfony 2 core directory and replaced the namespace below:&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;pre class=&quot;syntax-highlight&quot;&gt;// namespace Symfony\Framework\WebBundle\Console; // original
namespace Bundle\CartBundle\Console; // new&lt;/pre&gt;&lt;/blockquote&gt;&amp;nbsp;and replaced the use path in the console script, too:&lt;br /&gt;
&lt;blockquote&gt;&lt;pre class=&quot;syntax-highlight&quot;&gt;//use Symfony\Framework\WebBundle\Console\Application; // original
use Bundle\CartBundle\Console\Application; // new&lt;/pre&gt;&lt;/blockquote&gt;&lt;span class=&quot;midashi&quot;&gt;&amp;nbsp;I added an ASCII Art, which is the unofficial charactor of symfony that was born in the Japanese symfony comunity and twitter. Her name is &quot;&lt;/span&gt;&lt;span class=&quot;midashi&quot;&gt;Symfo-Nyan&quot;, she is cute!&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;midashi&quot;&gt;You can see the original &lt;a href=&quot;http://d.hatena.ne.jp/FurryChildren/20100210/p2&quot;&gt;in this page&lt;/a&gt;.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;midashi&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;midashi&quot;&gt;OK, after adding the ASCII Art to the message, I ran the console again:&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;midashi&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://f.hatena.ne.jp/images/fotolife/b/brtRiver/20100218/20100218231443.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;320&quot; src=&quot;http://f.hatena.ne.jp/images/fotolife/b/brtRiver/20100218/20100218231443.png&quot; width=&quot;192&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span class=&quot;midashi&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;midashi&quot;&gt;&amp;nbsp;&lt;/span&gt; I saw it is easy to customize Symfony 2 but if you are not used to using &quot;namespace&quot; with PHP, you should learn about it.</content><link rel='replies' type='application/atom+xml' href='http://pugi-pogi.blogspot.com/feeds/4962810932312235542/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://pugi-pogi.blogspot.com/2010/02/try-to-customize-console-script-in.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5686566953211058816/posts/default/4962810932312235542'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5686566953211058816/posts/default/4962810932312235542'/><link rel='alternate' type='text/html' href='http://pugi-pogi.blogspot.com/2010/02/try-to-customize-console-script-in.html' title='Try to customize the console script in Symfony2'/><author><name>brtriver</name><uri>http://www.blogger.com/profile/18186582962875019152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMW2QYYH7n_40fs8Z_qtK7RlBnXUfrife8JNlyPg6tYmqZczOVhovI3VZ9S5q1nMKlWeWY_Gl3ylsxKNLtsNYKdL56nfXSOSemCeg6_8h3QtJobYGCFjStezaKS1qoEA/s220/nya.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5686566953211058816.post-5481645042152147438</id><published>2010-02-16T01:53:00.000+09:00</published><updated>2010-02-16T01:53:32.854+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="php"/><category scheme="http://www.blogger.com/atom/ns#" term="symfony"/><title type='text'>symfony session storage with using MongoDB</title><content type='html'>MongoDB is&amp;nbsp; an &lt;a class=&quot;mw-redirect&quot; href=&quot;http://en.wikipedia.org/wiki/Open_source_software&quot; title=&quot;Open source software&quot;&gt;open source&lt;/a&gt;, scalable, high-performance, schema-free, &lt;a href=&quot;http://en.wikipedia.org/wiki/Document-oriented_database&quot; title=&quot;Document-oriented database&quot;&gt;document-oriented database&lt;/a&gt; written in the &lt;a href=&quot;http://en.wikipedia.org/wiki/C%2B%2B&quot; title=&quot;C++&quot;&gt;C++&lt;/a&gt; programming language.((via: &lt;a href=&quot;http://en.wikipedia.org/wiki/MongoDB&quot;&gt;wikipedia&lt;/a&gt;)) &lt;br /&gt;
&lt;br /&gt;
symfony has the file session storage class, PDO session storage class but has no MongoDB session storage class. &lt;br /&gt;
&lt;br /&gt;
So I wrote the symfony session storage class with using MongoDB.&lt;br /&gt;
You can use below. &lt;br /&gt;
&lt;a href=&quot;http://github.com/brtriver/sfMongoSessionStorage&quot;&gt;http://github.com/brtriver/sfMongoSessionStorage&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
As a matter of course I don&#39;t think MongoDB is the best solution for session storage but it&#39;s faster than MySQL session storage.&lt;br /&gt;
&lt;h4&gt;configuration&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;If you use sfMongoSessionStorage class, you configure the factories.yml.&lt;br /&gt;
&lt;blockquote&gt;&lt;br /&gt;
&lt;pre class=&quot;syntax-highlight&quot;&gt;&lt;span class=&quot;synIdentifier&quot;&gt;storage&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt;
     &lt;span class=&quot;synIdentifier&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt; sfMongoSessionStorage
     &lt;span class=&quot;synIdentifier&quot;&gt;param&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt;
       &lt;span class=&quot;synIdentifier&quot;&gt;host&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt; localhost         &lt;span class=&quot;synComment&quot;&gt; #hostname&lt;/span&gt;
       &lt;span class=&quot;synIdentifier&quot;&gt;port&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;synConstant&quot;&gt;27017&lt;/span&gt;             &lt;span class=&quot;synComment&quot;&gt; #port number&lt;/span&gt;
       &lt;span class=&quot;synIdentifier&quot;&gt;db_name&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt; symfony        &lt;span class=&quot;synComment&quot;&gt; #DB name&lt;/span&gt;
       &lt;span class=&quot;synIdentifier&quot;&gt;collection_name&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;:&lt;/span&gt; session&lt;span class=&quot;synComment&quot;&gt; #collection name&lt;/span&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;
&lt;h4&gt; bench mark results&lt;/h4&gt;This is the bench mark results on my local machine. &lt;br /&gt;
$ ab -n 5000 -c 100 http://localhost/index.php&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;&lt;pre&gt;MySQL   =&amp;gt; Requests per second:    10.86 [#/sec] (mean)
MongoDB =&amp;gt; Requests per second:    16.61 [#/sec] (mean)

Default =&amp;gt; Requests per second:    17.58 [#/sec] (mean)&lt;/pre&gt;&lt;/blockquote&gt;MongoDB session storage is much faster than MySQL one.</content><link rel='replies' type='application/atom+xml' href='http://pugi-pogi.blogspot.com/feeds/5481645042152147438/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://pugi-pogi.blogspot.com/2010/02/symfony-session-storage-with-using.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5686566953211058816/posts/default/5481645042152147438'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5686566953211058816/posts/default/5481645042152147438'/><link rel='alternate' type='text/html' href='http://pugi-pogi.blogspot.com/2010/02/symfony-session-storage-with-using.html' title='symfony session storage with using MongoDB'/><author><name>brtriver</name><uri>http://www.blogger.com/profile/18186582962875019152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMW2QYYH7n_40fs8Z_qtK7RlBnXUfrife8JNlyPg6tYmqZczOVhovI3VZ9S5q1nMKlWeWY_Gl3ylsxKNLtsNYKdL56nfXSOSemCeg6_8h3QtJobYGCFjStezaKS1qoEA/s220/nya.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5686566953211058816.post-366542567853829806</id><published>2010-02-16T01:25:00.001+09:00</published><updated>2010-02-16T01:28:55.685+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="introduction"/><title type='text'>I start a new blog in English</title><content type='html'>My name is Masao Maeda and my online name is brtRiver.&lt;br /&gt;
I am a web developer in Japan.&lt;br /&gt;
I want to study English and to make friends all over the world.&lt;br /&gt;
So I start to write a new blog about the snippets of the web development in English.&lt;br /&gt;
Please feel free to follow me &quot;brtriver&quot; on twitter.&lt;br /&gt;
&lt;br /&gt;
Mainly about PHP (symfony, CakePHP and so on..), I&#39;ll post :)</content><link rel='replies' type='application/atom+xml' href='http://pugi-pogi.blogspot.com/feeds/366542567853829806/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://pugi-pogi.blogspot.com/2010/02/i-start-new-blog-in-english.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5686566953211058816/posts/default/366542567853829806'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5686566953211058816/posts/default/366542567853829806'/><link rel='alternate' type='text/html' href='http://pugi-pogi.blogspot.com/2010/02/i-start-new-blog-in-english.html' title='I start a new blog in English'/><author><name>brtriver</name><uri>http://www.blogger.com/profile/18186582962875019152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMW2QYYH7n_40fs8Z_qtK7RlBnXUfrife8JNlyPg6tYmqZczOVhovI3VZ9S5q1nMKlWeWY_Gl3ylsxKNLtsNYKdL56nfXSOSemCeg6_8h3QtJobYGCFjStezaKS1qoEA/s220/nya.jpg'/></author><thr:total>2</thr:total></entry></feed>