Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Jsonrpc Laravel Package

agentsib/jsonrpc

View on GitHub
Deep Wiki
Context7

Customize serializer

You can customize serializer for change input and output format. For example:

<?php

namespace AgentSIB\JsonRpcBundle\Server;

use AgentSIB\JsonRpc\JsonRpcException;
use AgentSIB\JsonRpc\Serializers\JsonRpcSerializerInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;

class SymfonyJsonRpcSerializer implements JsonRpcSerializerInterface
{
    /**
     * [@inheritdoc](https://github.com/inheritdoc)
     */
    public function parseRequest ($request)
    {
        if ($request instanceof Request) {
            return [@json_decode](https://github.com/json_decode)($request->getContent(), false, 32);
        }
        throw new JsonRpcException(JsonRpcException::ERROR_PARSE_ERROR);
    }

    /**
     * [@inheritdoc](https://github.com/inheritdoc)
     */
    public function serializeResponse ($response)
    {
        return new JsonResponse($response);
    }
}

As well, you can use additional checks. For example:

// ...
public function parseRequest ($request)
{
    if (!$this->checkSignature($request->getContent())) {
        throw new JsonRpcException(JsonRpcException::ERROR_INVALID_REQUEST);
    }
    if ($request instanceof Request) {
        return [@json_decode](https://github.com/json_decode)($request->getContent(), false, 32);
    }
    throw new JsonRpcException(JsonRpcException::ERROR_PARSE_ERROR);
}
// ...

And something more...

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
nexmo/api-specification
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
ecotone/kafka
22h/doctrine-garbage-collection-bundle
agtp/agtp-php
agtp/mod-php
splash/sonata-admin
splash/metadata