You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After some discussion in discord, I think the best approach would be to generate PHP interfaces that have the appropriate docblocks for each service method.
Example:
<?phpnamespace Rpc/Types;
interface MathService
{
/** * My awesome method description * * @param int|float $a is a really cool number * @param int|float $a another cool number * @return int|float the result of $a + $b */publicfunctionaddition($a, $b);
}
Namespace & output path should be configurable ideally (didn't dig much into this repo yet to see the CLI params).
Some users may want their interfaces strongly typed with param/return types, but the easiest thing for the time being is to skip that part and just do docblocks at first. Could have some config to allow for enabling strong types, for example, using PHP 8.0 union types:
<?phpnamespace Rpc/Types;
interface MathService
{
/** * My awesome method description * * @param int|float $a is a really cool number * @param int|float $a another cool number * @return int|float the result of $a + $b */publicfunctionaddition(int|float$a, int|float$b) : int|float;
}
After some discussion in discord, I think the best approach would be to generate PHP interfaces that have the appropriate docblocks for each service method.
Example:
Namespace & output path should be configurable ideally (didn't dig much into this repo yet to see the CLI params).
Some users may want their interfaces strongly typed with param/return types, but the easiest thing for the time being is to skip that part and just do docblocks at first. Could have some config to allow for enabling strong types, for example, using PHP 8.0 union types:
P.S. My preferred JSON-RPC server lib in PHP is https://github.com/datto/php-json-rpc, also includes a client which is useful for testing etc.
The text was updated successfully, but these errors were encountered: