Skip to content

rfrommherz/api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

Api Bundle

Installation

  1. composer req rfrommherz/api
  2. config/bundles.php: Add new bundle to bundles.php
Rf\ApiBundle\JwtBundle::class => ['dev' => true],

Usage

ApiDto

ApiDto's can be used as parameters in your controllers. To enable the support for this, your class must extend ApiDto. Each ApiDto is passed to the symfony validator, which enables the support for validation annotations.

use Rf\ApiBundle\Dto\ApiDto;
use Symfony\Component\Validator\Constraints as Assert;

class Fetch extends ApiDto
{
    /**
     * @Assert\NotBlank
     * @Assert\Url
     * @var string
     */
    private string $repositoryUrl;

Arguments will be automatically resolved and can be passed as controller arguments.

public function index(Fetch $fetch): Response
{
    ...
}
curl --location --request GET 'http://localhost/fetch' \
--header 'Content-Type: application/json' \
--data-raw '{
    "repositoryUrl": "http://...",
}'

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages