sowl/laravel-doctrine-jsonapi 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

sowl/laravel-doctrine-jsonapi

Composer 安装命令:

composer require sowl/laravel-doctrine-jsonapi

包简介

Package for the Laravel that allows developers to create JSON:API endpoints using the Doctrine ORM for data persistence.

README 文档

README

Build Status Code Coverage Latest Stable Version Total Downloads License: MIT

Implement feature-rich JSON:API compliant APIs in your Laravel applications using Doctrine ORM.

Overview

This package provides a comprehensive implementation of the JSON:API specification for Laravel applications using Doctrine ORM instead of Eloquent. It reduces boilerplate code by offering default controllers and actions that handle standard API operations while ensuring full compliance with the JSON:API standard.

Documentation

For detailed installation instructions, configuration guides and tutorials:

https://scholarshipowl.github.io/laravel-doctrine-jsonapi/

Features

  • Complete JSON:API Implementation: Full compliance with the JSON:API specification
  • Built for Doctrine ORM: Designed specifically for Laravel applications using Doctrine ORM
  • Battle-tested: Production-ready and robust
  • Standardised, Consistent APIs: Uniform interface for all resources
  • Resource Operations:
    • Fetch resources with advanced querying
    • Fetch and manipulate relationships
    • Inclusion of related resources (compound documents)
    • Sparse field sets
    • Sorting
    • Pagination
    • Filtering
  • Full CRUD Support:
    • Create resources
    • Update resources
    • Update relationships
    • Delete resources
  • Authorization: Policy-based access control
  • Auto-generated Documentation: Endpoints are automatically documented using Scribe

Bugs:

  • In the WithUpdateRelationshipsTrait the we use UpdateToManyRelationshipsRequest for updating to-one relationships.
  • Relationships with multipe resource type are not supported. Example is when we use inheritance type single table and we have different type for same table / relationship.

Roadmap

  • Docs: Quickstart add how to install PHP section ( @see: php.new )
  • Build documentation and testing for integration of Laravel Sanctum or Laravel Passport.
  • Add Laravel Doctrine ACL package to testing
  • Provide QueryBuilder for the filter parsers, instead of criteria as it allows to apply any types of filters.
  • Remove the default request hydration from the package, as it may create security vulnerabilities. All the mutations should be handled by the application code, by the client.
  • Improve security by adding ability checks on the transformer level when we try to include relationships.
  • Scribe: Generated headers are not prperly defined, we got Accept: / everywhere.
  • Allow override or provide ability for custom request authentication.
  • Integrate scribe into the package. Automatically generate Open API specs.
    • Add documentation for scribe integration
    • Update metadata for each endpoint
      • Endpoint description
      • Endpoint tags
      • Endpoint name
      • Endpoint group
    • Route\URL params documentation
    • Query params documentation
      • Add a fields lists to each query documentation. Need to extract it from the transformer.
      • Filter query parameters documentation
    • Request body documentation
      • Analyze scribe default rules parser find ways to improve it.
    • Response body documentation
      • Create ValidationResponseAttribute that goint to read rules from validation and generate example response.
  • Add documentation about the meta param usage. ( meta[account]=mailbox&meta[profile]=completeness )
  • Make it possible to disable links generation. As it is not required by JSON:API spec and increases response size.
  • Add generics to all the types using ResourceInterface
  • Move default routes to the separate file and load them on boot. ( see how Scribe doing it )
  • Create a validation rule "resource", "resourceExists" for validating resource identifier. Example of usage: php $this->validate($request, [ 'data' => 'required|resource:users', ]);
  • Create default global error handler or write down documentation how to create such one. How to handle missing route\endpoint 404 and internal 500 errors.
  • Checkout option for adding include params like "include=roles:sort" (TransformerAbstract.php:173)
  • Integrate UUID support by default https://github.com/ramsey/uuid-doctrine

Next version

  • Use PHP Attributes instead of ResourceInterface for the resource declaration.
  • Metadata managment system similar to Doctrine one, that knows the resource schemas and relationships, etc. On boot register all the resources and cache them.
    • Resource type, transformers, relationships discovery, moved to the metadata system / ResourceManager.
    • Generate the resourceType depend on the entity name
    • Generate the transformers depend on the entity name and configuration path: app/Transformers/{Entity}Transformer.php
    • Allow defining relationships with PHP Attributes on the entity class.
    • The id get be retrieved using internal Doctrine functionality or just depend on public $id property.
  • Migrate all the default users and roles to be UUID
  • Improve transformer, make it handle relationships depend on resource. Use better name like "ResourceTransformer".

Support

If you encounter any issues or have questions, please report them using the GitHub Issues tracker.

License

This project is licensed under the MIT License - see the LICENSE file for details.

sowl/laravel-doctrine-jsonapi 适用场景与选型建议

sowl/laravel-doctrine-jsonapi 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 921 次下载、GitHub Stars 达 0, 最近一次更新时间为 2023 年 02 月 20 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 sowl/laravel-doctrine-jsonapi 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 sowl/laravel-doctrine-jsonapi 我们能提供哪些服务?
定制开发 / 二次开发

基于 sowl/laravel-doctrine-jsonapi 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-02-20