Skip to content

Releases: georgique/yii2-jsonrpc

Mate

08 Sep 22:18
Compare
Choose a tag to compare

Removed compatibility with PHP5.6, improved compatibility with PHP7+.

Rooibos

27 May 03:15
Compare
Choose a tag to compare

This release contains:

  • Fix in case target method response is empty
  • Fix in case application works under relative url

Oolong

17 Feb 11:18
Compare
Choose a tag to compare

This release contains:

  • Serializer . Idea is based on Yii2 native REST serializer, but it's adapted for the Json RPC protocol.
  • Improved error handling. Now JsonRpcError has data property, which goes error.data property in response. Besides that, error.data will contains the following:
    • exception - original exception
    • human_message - message which you can show on the client-end directly to user. By default comes from the PREVIOUS exception message, so if you throw any exception in an action, it's message will go here.
    • error_code - original error code. Same approach as with human_message, goes from PREVIOUS exception, gives ability to react on errors better on a client side.

Earl Grey

04 Nov 19:21
Compare
Choose a tag to compare

Refactoring release.

Hotfix

13 Jun 19:34
efeb108
Compare
Choose a tag to compare

Fixed an issue with the JsonRpcRequest class missing $originalRequest property.

Black Tea

21 May 23:40
aa4685c
Compare
Choose a tag to compare

Code has been tested and seems to work good enough. Ready to rock on productions.

Alternative way to pass params to target action

06 Mar 23:37
Compare
Choose a tag to compare

Sometimes, there can be a lot of params sent within json-rpc request, e.g. model attributes for it's creation. In order to not list all of them as action arguments, an alternative way to pass params is introduced. Now an entry point can be customized, and params will be passed to target action as Yii request body params (see README).
Also now method-to-action translation involves UrlManager, so following requests are possible now:

{"jsonrpc": "2.0", "method": "api1.user.2.update", "params": {"email": "updated-email@example.com"}, "id": 1}

With the customized entry point you can easily have the following action:

    public function actionUpdate($id) {
        $model = $this->findModel($id);
        if (!$model) {
            throw new NotFoundHttpException('Requested model not found.');
        }
        $model->setScenario($this->updateScenario);
        $model->load(Yii::$app->getRequest()->getBodyParams(), '');
        if ($model->save()) {
            return $model;
        } elseif (!$model->hasErrors()) {
            throw new ServerErrorHttpException('Failed to update the object for unknown reason.');
        }

        return $model;
    }

If that doesn't look familiar - it's just typical UPDATE action from Yii2 REST module. Voi la!

First beta release

27 Feb 14:33
Compare
Choose a tag to compare
First beta release Pre-release
Pre-release

Extension is tested and works well. There are still some improvements to be done, but it is now in usable (not PRODUCTION yet though) condition.

Critical fix for exception handling

26 Feb 22:10
Compare
Choose a tag to compare
Pre-release

1.0-alpha.2 had a critical bug leading to an empty response instead of correctly rendered error. Fixed in this one.

Better exception handling

26 Feb 17:02
Compare
Choose a tag to compare
Pre-release

This release moves extension closer to the stable state, but still far from it as it is not well tested. Exception handling was improved since the previous alpha and initial successful tests were done.