当前位置: 首页 > 软件库 > 开发工具 > PHP开发工具 >

laravel-json-api

授权协议 Apache-2.0 License
开发语言 PHP
所属分类 开发工具、 PHP开发工具
软件类型 开源软件
地区 不详
投 递 者 方璞
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

Tests

cloudcreativity/laravel-json-api

Status

This package has now been rewritten, substantially improved and released as the laravel-json-api/laravel package.Documentation for the new version is available on our new website laraveljsonapi.io and thecode is now developed under theLaravel JSON:API Github organisation.

The cloudcreativity/laravel-json-api package is now considered to be the legacy package. As we know it is in use ina lot of production applications, it will continue to receive bug fixes and updates for new Laravel versions. However,it is no longer supported for new features.

If you are starting a new project, please use thenew package laravel-json-api/laravel instead.

Introduction

Build feature-rich and standards-compliant APIs in Laravel.

This package provides all the capabilities you need to add JSON APIcompliant APIs to your application. Extensive support for the specification, including:

  • Fetching resources
  • Fetching relationships
  • Inclusion of related resources (compound documents)
  • Sparse fieldsets.
  • Sorting.
  • Pagination.
  • Filtering
  • Creating resources.
  • Updating resources.
  • Updating relationships.
  • Deleting resources.
  • Validation of:
    • JSON API documents; and
    • Query parameters.

The following additional features are also supported:

  • Full support for Eloquent resources, with features such as:
    • Automatic eager loading when including related resources.
    • Easy relationship end-points.
    • Soft-deleting and restoring Eloquent resources.
    • Page and cursor based pagination.
  • Asynchronous processing.
  • Support multiple media-types within your API.
  • Generators for all the classes you need to add a resource to your API.

What is JSON API?

From jsonapi.org

If you've ever argued with your team about the way your JSON responses should be formatted, JSON API is youranti-bikeshedding weapon.

By following shared conventions, you can increase productivity, take advantage of generalized tooling, and focus onwhat matters: your application. Clients built around JSON API are able to take advantage of its features aroundefficiently caching responses, sometimes eliminating network requests entirely.

For full information on the spec, plus examples, see http://jsonapi.org.

Tutorial and Documentation

Want a tutorial to get started? Read theHow to JSON:API Laravel tutorial.

Full package documentation is available onRead the Docs.

Slack

Join the Laravel JSON:API community onSlack.

Laravel Versions

Laravel This Package
^8.0 ^3.0
^7.0 ^2.0
^6.0 ^1.7
5.8.* ^1.7
5.7.* ^1.0
5.6.* ^1.0
5.5.* ^1.0

Make sure you consult the Upgrade Guidewhen upgrading between major or pre-release versions.

License

Apache License (Version 2.0). Please see License File for more information.

Installation

Installation is via composer. See the documentation for complete instructions.

Contributing

Contributions are absolutely welcome. Ideally submit a pull request, even more ideally with unit tests. Please note thefollowing:

  • Bug Fixes - submit a pull request against the master branch.
  • Enhancements / New Features - submit a pull request against the develop branch.

We recommend submitting an issue before taking the time to put together a pull request.

  • 在使用laravel-admin的模型表单的时候,有个字段是json格式,新增的时候总是不能成功,经过排查源代码,发现他在校验有效column的时候,会根据form提交的字段进行null判断,源码位置如下: D:\WWW\xxx\vendor\encore\laravel-admin\src\Form.php line :900 protected function prepareInsert($

 相关资料
  • 我有一个严重的问题与Livewire从api响应传递数据到组件刀片文件。起初它加载良好,当我点击的时候。下拉列表会在下面抛出一个错误。 Livewire在尝试为[sign up]组件添加水合物时遇到损坏的数据。确保Livewire组件的[名称、id、数据]在请求之间未被篡改。 我有一个我正在加载的下拉列表,一开始它加载得很好,但当我从下拉列表中选择某个内容时,它抛出了那个错误。 下面是我的组件代码

  • 问题内容: 这是我第一次在laravel中使用验证。我正在尝试对以下json对象应用验证规则。json对象名称是有效负载,下面给出示例。 验证码如下所示,出于测试目的,我将数字验证为数字。当我执行以下代码时,上面的json对象被批准并插入到我的数据库中。相反,它应该给我一个例外,因为我正在传递带有字母数字值的名称,是我做错了什么: 问题答案: 请这样 验证中的字段必须是数字,并且必须具有确切的值长

  • 问题内容: 我试图向laravel发送json的发布请求。该请求在服务器上收到,但是当我尝试访问属性时,我得到: “试图获取非对象的属性” 。在客户端上,我正在使用angularjs。 角度: laravel: 注意:我可以在Fiddler中看到正在发送的JSON是有效的,并且到达了controller + method(http 200)。 帖子请求本身(如Fiddler所示) 问题答案: La

  • 我试图在XAMP中创建一个json数据库,在使用phpmyAdmin时,它显示我正在使用mariaDB,但在我的它显示在端口3306上运行。我正在使用Laravel 5.4 framework创建数据库,下面是我尝试执行的迁移: 现在,在执行此操作时,我遇到以下错误: SQLSTATE[42000]:语法错误或访问冲突: 1064你有一个错误在您的SQL语法;检查手册,对应于您的MariaDB服务

  • 我目前正在使用Laravel v7。2.安装babenkoivan/scout elasticsearch驱动程序(4.2)并使用AWS elasticsearch 7.1调幅。在我的应用程序中映射了几个表,这些表工作正常,但嵌套映射存在问题,以前该映射工作正常,现在已损坏。 我将数据保存到一个表中,并将该表数据复制到AWS Elasticsearch中。我使用MySQL 5.6,所以我使用TEX

  • 问题内容: 如果我返回一个对象: 状态代码将为200。如何将其更改为201,并显示一条消息并与json对象一起发送? 我不知道是否有一种方法可以在Laravel中设置状态代码。 问题答案: 您可以用来设置HTTP响应代码。 如果未传递任何参数,则http_response_code将获取当前状态码。如果您传递参数,它将设置响应代码。 对于Laravel: