rafaelwendel / phpsupabase

PHP Client to use Supabase
MIT License
187 stars 17 forks source link

Add support for RCP #8

Open PoeHaH opened 1 year ago

PoeHaH commented 1 year ago

Hi @rafaelwendel

I am using your library in a project where I need to run some advanced queries containing aggregates etc. The createCustomQuery function does not cover this (neither does the equivalent in Supabase itself).

To get around that, I am creating database functions via the Supabase UI and using their RPC API endpoint to execute the function and return the results. This works well!

RPC is not part of your library so I am manuallyu calling it this way:

$service = self::get_service( 'rest' );
$result = $service->executeHttpRequest( 'GET', $my_base_url . 'rpc/function_name', [ 'headers' => $service->getHeaders() ] );

This works without issue, but it would be cleaner if your library had a function to call RPC directly. Perhaps you can consider to include it in a next update? Thanks!

pennadl commented 1 year ago

Just posted a similar comment, would be helpful to integrate the possibility to call stored procedures. Thanks!

Jameswlepage commented 8 months ago

This would be huge!