承接 grzegorz-jamroz/sf-api-bundle 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

grzegorz-jamroz/sf-api-bundle

Composer 安装命令:

composer require grzegorz-jamroz/sf-api-bundle

包简介

Bundle provides basic features for Symfony Api.

README 文档

README

Bundle provides basic features for Symfony Api

Code Coverage Code Coverage Release Version Read License

Installation

composer require grzegorz-jamroz/sf-api-bundle

Development with Docker

Build and run the containers:

docker compose up -d

Copy vendor folder from container to host

docker compose cp app:/app/vendor ./vendor

Run static analysis

docker compose exec app bin/fix

Run tests

docker compose exec app bin/test

Run single test file:

docker compose exec app vendor/bin/phpunit --filter <testMethodName> <path/to/TestFile.php>
docker compose exec app vendor/bin/phpunit --filter testShouldReturnExpectedFloat tests/Unit/TransformNumeric/ToFloatTest.php

Enable xdebug

docker compose exec app xdebug on

Disable xdebug

docker compose exec app xdebug off

Run coverage report

  1. Enable xdebug
  2. Run:
docker compose exec app bin/coverage

Usage

Add to your config/routes.yaml file

# config/routes.yaml

ifrost_api:
    resource: ../src/Action/
    type: ifrost_api

Default config

You can add config/packages/ifrost_api.yaml in your project to enable/disable some features if not necessary

# config/packages/ifrost_api.yaml
# You can enable/disable some features if not necessary
ifrost_api:
  api_request: true
  exception_listener: false

and from now you can add attribute Symfony\Component\Routing\Annotation\Route to your Action class for example:

<?php
declare(strict_types=1);

namespace App\Action\Product;

use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;

#[Route('/product/promotion', name: 'product_promotion', methods: ['POST'])]
class PromoteAction
{
    public function __invoke(): Response
    {
        return new JsonResponse(['message' => 'product promotion']);
    }
}

and when you run bin/console debug:router you will see:

 ------------------- -------- -------- ------ -----------------------------------
  Name                Method   Scheme   Host   Path
 ------------------- -------- -------- ------ -----------------------------------
  product_promotion   POST     ANY      ANY    /product/promotion
 ------------------- -------- -------- ------ -----------------------------------

统计信息

  • 总下载量: 162
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 2
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2022-05-18

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固