DocBlock annotations in Laravel 5.1

DocBlock annotations in Laravel

When Laravel 5 was being developed, support for routing and event listeners via DocBlock annotations was originally added. Its syntax was similar to Symfony and Zend.

 

 

Symfony

The syntax for Symfony is as follows:

/**
 * @Route("/accommodations/search")
 * @Method({"GET"})
 */

public function searchAction($id)
{

Zend

The syntax for Zend is as follows:

/**
 * @Route(route="/accommodations/search")
 */

public function searchAction()
{

Laravel

The syntax for Laravel is as follows:

/**
 * @Get("/hotels/search")
 */

public function search()
{


What type of problem does the DocBlock annotation try to solve though?

Recommended :  Database versioning with the migrations system In Laravel

About the author

Deven Rathore

I'm Deven Rathore, a multidisciplinary & self-taught designer with 3 years of experience. I'm passionate about technology, music, coffee, traveling and everything visually stimulating. Constantly learning and experiencing new things.

Pin It on Pinterest

Shares