O'Reilly logo

Getting Started with Phalcon by Stephan Miller

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Examining our Posts controller

Now let's open PostsController.php file located at app/controllers in our editor. There is definitely a lot going on in this file. There are seven methods in our PostsController class suffixed with actions. Each of these actions handles requests and creates responses in our application. Each corresponds to a URI in our application: http://localhost/phalconBlog/[model]/[action]. When we browse to http://www.localhost/phalconBlog/posts/, by default, the indexAction function is called.

Let's take a look at each of these actions and modify them if we need to.

Create

Let's take a look at the createAction function, which saves our new blog posts for us.

First, we should learn a little about Phalcon\Mvc\Dispatcher. The dispatcher ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required