Download the PHP package otezvikentiy/json-rpc-api without Composer

On this page you can find all versions of the php package otezvikentiy/json-rpc-api. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package json-rpc-api

OtezVikentiy Symfony Json RPC API Bundle

The bundle allows you to quickly and conveniently create JSON RPC API applications based on the Symfony framework.


Features

github: https://github.com/OtezVikentiy/symfony-jsonrpc-api-bundle


Bundle installation

see how to easily install bundle.


Examples

During the installation process, we defined the src/RPC/V1/{*Method.php} directory in the services and marked with tags in it all the classes ending in *Method.php - these will be our API endpoints.

link description files list curl
see example Base easiest example. Request.php, Response.php, GetProductsMethod.php curl --header "Content-Type: application/json" --request POST --data '{"jsonrpc": "2.0","method": "getProducts","params": {"title": "AZAZAZA"},"id": 1}' http://localhost/api/v1
see example Example with callbacks. Request.php, Response.php, GetProductsMethod.php, AbstractMethod.php curl --header "Content-Type: application/json" --request POST --data '{"jsonrpc": "2.0","method": "getProducts","params": {"title": "AZAZAZA"},"id": 1}' http://localhost/api/v1
see example Example when you need to give in response not single object, but a number of objects. Request.php, Response.php, GetProductsMethod.php, Product.php curl --header "Content-Type: application/json" --request POST --data '{"jsonrpc": "2.0","method": "getProducts","params": {"title": "AZAZAZA"},"id": 1}' http://localhost/api/v1
see example Sometimes you may need to return from API not only a json response, but a picture or a document for example. In such a case you can use this example. Request.php, ErrorResponse.php, PlainResponse.php, GetProductsMethod.php curl --header "Content-Type: application/json" --request POST --data '{"jsonrpc": "2.0","method": "getProducts","params": {"title": "AZAZAZA"},"id": 1}' http://localhost/api/v1

Swagger

If you wish to generate openapi swagger yaml file - then run this command:

It would generate a swagger file public/openapi/api_v1.yaml which you can use in your swagger instance.

see example of how to combine multiple endpoints with tags

see example how to define default, format and example for scalar properties of response

see example how to describe array properties of response


Security

Initially, two implementation options are provided and tested, described below, but you are free to connect any other software solutions to your taste and color.

Auth via lexik jwt token bundle

Auth via self-written system

You may need to add a role model to restrict user access. You always have the option to implement your own version, but there is also a built-in implementation based on the simplest Symfony Security version.

Built-in roles usage example


All versions of json-rpc-api with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
doctrine/annotations Version ^2.0
symfony/framework-bundle Version >=6.3
symfony/yaml Version >=6.3
symfony/validator Version >=6.3
symfony/serializer Version >=6.3
symfony/console Version >=6.3
symfony/security-bundle Version ^7.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package otezvikentiy/json-rpc-api contains the following files

Loading the files please wait ....