PHP code example of kmfk / hateoas-bundle
1. Go to this page and download the library: Download kmfk/hateoas-bundle library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
kmfk / hateoas-bundle example snippets
public function registerBundles()
{
$bundles = array(
// ...
new Kmfk\Bundle\HateoasBundle\HateoasBundle(),
);
return $bundles;
}
#src/AcmeBundle/Entity/UserEntity.php
use Kmfk/Bundle/HateoasBundle/Annotation/Hateoas;
/**
* @Hateoas(
* name ="self",
* href ="/user/{id}/"
* params ={"id" = "getId"},
* groups ={"list"},
* type ="absolute"
* )
*/
class UserEntity
{
protected $id;
public function getId()
{
return $this->id;
}
}