Wednesday, March 23, 2011

New Japanese Symfony 1.4 book has been published!

On March 23, a new Japanese symfony(1.4) book had been published!

In Japan, there are a lot of technological books for PHP. but there was no Japanese symfony book for ver 1.4.
Until now there were two books for ver 1.0.
I had written one of Japanese symfony books for ver 1.0 in 2007. It's 4 years ago! Those who wanted to learn symfony and buy Japanese books always said that they couldn't buy symfony books because it'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's very important for developers to buy this book.

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.

And Fabien and Stefan gave us messages for this book. Thanks a lot!

via: http://books.symfony.gr.jp/14book/index.html (Japanese Only)

Friday, March 11, 2011

How to custmize the error page in Symfony2

We can see the new character, which name I don't know at the error page.

Speaking of the character, there is an unofficial symfony character, which name is "Symfonyan".

Symfonyan is "Symfony" + "Nayn". "Nyan" is Japanese which mean mew. She is pretty :D

So, I tried to change the character to Symfonyan in this error page.

How to customize the error page


At the first, I read the documentation Symfony - How to customize Error Pages. 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.

So I decided to make an original bundle, "SymfonyanBundle" because of making everyone use it easily.

How to install SymfonyanBundle


the source code of SymfonyanBundle is managed in Github. So you can install it by git command.
$ git clone git://github.com/brtriver/SymfonyanBundle.git src/Acme/SymfonyanBundle

You have to add this bundle in app/AppKernel.php

....
if (in_array($this->getEnvironment(), array('dev', 'test'))) {
    $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
    $bundles[] = new Symfony\Bundle\WebConfiguratorBundle\SymfonyWebConfiguratorBundle();
    $bundles[] = new Acme\DemoBundle\AcmeDemoBundle();
    $bundles[] = new Acme\SymfonyanBundle\SymfonyanBundle(); // <= addition
}


Confirm by the console. If you can add this bundle, you can see like below.
$ ./app/console
...
symfonyan
:exception-install Change the icon of the exception page to Symfonyan
:welcome-install Change the welcome page to Symfonyan

At the last, you have only to run this command from console. It's very simple and easy!

$ ./app/console symfonyan:exception-install --symlink
$ ./app/console assets:install web --symlink

Result


[404 in development env]

[404 in production env]

cute!

One more thing

You can customize the default welcome page with Symfonyan. It's easy to run the command below.

$ ./app/console symfonyan:welcome-install --symlink
The default page is translated to Japanese, too :)