Skip to content

Commit

Permalink
Prepare new version 0.6.1 with support for Symfony 4
Browse files Browse the repository at this point in the history
  • Loading branch information
Christoph Singer committed Mar 10, 2018
1 parent 69ca0b7 commit a243cc7
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 17 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ script: vendor/bin/phpunit

matrix:
allow_failures:
- env: SYMFONY_VERSION=^4
- env: SYMFONY_VERSION=dev-master
exclude:
- env: SYMFONY_VERSION=dev-master
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
### v0.6.1 2018-03-10 ###
- compatibility with Symfony 4, thanks to @shreypuranik
- make unit tests compatible with newer phpunit versions

### v0.6.0 2017-02-09 ###
- added compatibility with Symfony 3, thanks to @JasonMiesionczek
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2013-2017 Christoph Singer, Web-Agentur 72
Copyright (c) 2013-2018 Christoph Singer, Web-Agentur 72

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
JsonRpcBundle
=============

[![Build Status](https://secure.travis-ci.org/wasinger/jsonrpc-bundle.png?branch=master)](http://travis-ci.org/wasinger/jsonrpc-bundle)
[![Build Status](https://secure.travis-ci.org/wasinger/jsonrpc-bundle.svg?branch=master)](http://travis-ci.org/wasinger/jsonrpc-bundle)
[![Latest Version](http://img.shields.io/packagist/v/wa72/jsonrpc-bundle.svg)](https://packagist.org/packages/wa72/jsonrpc-bundle)
[![Downloads from Packagist](http://img.shields.io/packagist/dt/wa72/jsonrpc-bundle.svg)](https://packagist.org/packages/wa72/jsonrpc-bundle)


JsonRpcBundle is a bundle for Symfony 2 and 3 that allows to easily build a JSON-RPC server for web services using [JSON-RPC 2.0] (http://www.jsonrpc.org/specification).
JsonRpcBundle is a bundle for Symfony that allows to easily build a JSON-RPC server for web services using
[JSON-RPC 2.0](http://www.jsonrpc.org/specification).

*Currently it does not work yet with Symfony 4.*

The bundle contains a controller that is able to expose methods of any service registered in the Symfony service container as a JSON-RPC web service.
The bundle contains a controller that is able to expose methods of any public service registered in the Symfony service
container as a JSON-RPC web service.

Documentation
-------------

Documentation is found in [Resources/doc/index.rst](Resources/doc/index.rst).


© 2013-2017 Christoph Singer, Web-Agentur 72. Licensed under the MIT license.
© 2013-2018 Christoph Singer, Web-Agentur 72. Licensed under the MIT license.
30 changes: 22 additions & 8 deletions Resources/doc/index.rst
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
=============
JsonRpcBundle
=============

JsonRpcBundle is a bundle for Symfony 2.7 and up that allows to easily build a JSON-RPC server for web services using `JSON-RPC 2.0`_.

The bundle contains a controller that is able to expose methods of any service registered in the Symfony service container as a JSON-RPC web service. The return value of the service method is converted to JSON using `jms\_serializer`_.
The bundle contains a controller that is able to expose methods of any public service registered in the Symfony service container as a JSON-RPC web service. The return value of the service method is converted to JSON using `jms\_serializer`_.

Of course, it doesn't simply expose all your services' methods to the public, but only those explicitely mentioned in the configuration. And service methods cannot be called by it's original name but by an alias to be defined in the configuration.


Installation
------------
============

1. Add "wa72/jsonrpc-bundle" as requirement to your composer.json

Expand All @@ -27,9 +28,13 @@ Installation
Your JSON-RPC web service will then be available in your project calling the /jsonrpc/ URL.

Configuration
-------------
=============

You must configure which functions of the services registered in the Service Container will be available as web services.
There are two methods how to do this:

Method 1: Expose single methods from any service via yaml configuration
-----------------------------------------------------------------------

Configuration is done under the "wa72\_json\_rpc" key of your configuration (usually defined in your app/config/config.yml).
To enable a Symfony2 service method to be called as a JSON-RPC web service, add it to the "functions" array of the configuration.
Expand Down Expand Up @@ -66,10 +71,18 @@ If you use `jms\_serializer`_ you can also configure exclusion strategies (group
version: "1"
max_depth_checks: true
Method 2: tag a sercive to make all it's public methods callable by JSON-RPC
----------------------------------------------------------------------------

Starting with v0.4.0, it is also possible to fully expose all methods of a service by tagging it with ``wa72\_jsonrpc.exposable``.
All public methods of services tagged with 'wa72\_jsonrpc.exposable' can be called via JSON-RPC. The method name
to be used in the RPC call is "service\:method", i.e. the name of the service and the method separated by colon.


Notes
=====

**New in Version 0.5.0**: It is now possible to call methods that require objects as parameters (in previous versions
only methods with scalar and array parameters could be called).
That's why *JMSSerializerBundle is now a required dependency*.
Expand All @@ -78,10 +91,11 @@ For this to work, the following conditions must be met:
- The method parameters must be correctly type hinted
- The classes used as parameters must contain `jms\_serializer @Type annotations for their properties <http://jmsyst.com/libs/serializer/master/reference/annotations#type>`_


Testing
-------
=======

The bundle comes with a test service. If you have imported the bundle's routing to ``/jsonrpc`` (see above)
The bundle comes with a simple test service. If you have imported the bundle's routing to ``/jsonrpc`` (see above)
register the test service in your DI container:

.. code-block:: yaml
Expand All @@ -105,10 +119,10 @@ and you should get the following answer:
{"jsonrpc":"2.0","result":"Hello Joe!","id":"foo"}
There are also unit tests for phpunit. Just install the required dependencies using ``composer install`` and run
``phpunit`` in the root directory of the project.
There are also unit tests for phpunit. Just install the required development dependencies using ``composer install`` and run
``vendor/bin/phpunit`` in the root directory of the project.

© 2013-2017 Christoph Singer, Web-Agentur 72. Licensed under the MIT license.
© 2013-2018 Christoph Singer, Web-Agentur 72. Licensed under the MIT license.


.. _`JSON-RPC 2.0`: http://www.jsonrpc.org/specification
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name":"wa72/jsonrpc-bundle",
"description":"JSON-RPC server for Symfony: exposes services registered in the service container as JSON-RPC webservices",
"keywords":["json", "rpc", "jsonrpc", "json-rpc", "webservice", "symfony4bundle" ],
"keywords":["json", "rpc", "jsonrpc", "json-rpc", "webservice", "symfony", "symfony-bundle" ],
"homepage":"http://github.com/wasinger/jsonrpc-bundle",
"license":"MIT",
"type": "symfony-bundle",
Expand Down

0 comments on commit a243cc7

Please sign in to comment.