Giter VIP home page Giter VIP logo

supabase-php's Introduction

Supabase PHP Client supabase-php

PHP Client library to interact with Supabase.

Note: This repository is in Alpha and is not ready for production usage. API's will change as it progresses to initial release.

TODO

  • Integrate storage-php
  • Integrate functions-php
  • Integrate gotrue-php
  • Integrate postgrest-php
  • Integrate realtime-php
  • Handle global options
  • Support for PHP 7.4

Quick Start Guide

Installing the module

composer require supabase/supabase-php

Getting started with the client

use Supabase\CreateClient;

$client = new CreateClient($reference_id, $api_key);

supabase-php's People

Contributors

tehnorm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

supabase-php's Issues

Support localhost (and other unconventional) Supabase instances

Feature request

Is your feature request related to a problem? Please describe.

When you have a local development server through the CLI, you can't connect to it using supabase-php as it's constructor(s) are all split up and has (as of right now) no way to just specify a full URL. This is worsened when you also have whatever you're working on also in docker, which then uses http://supabase_kong_core as it's hostname instead.

Describe the solution you'd like

A method to just specify the full URL rather than specifying each variable that ends up building a URL anyway. (Maybe possible to just check if $reference_id is a valid URL and use that instead? - bonus: it'll also follow what supabase-js and others do as well)

Describe alternatives you've considered

Adding an entry to /etc/hosts could work if what you're working on always runs on the host machine (probably - I haven't tested fully).

The only solution right now is to just use actual supabase (which eats into limits) or an externally self-hosted instance on a domain. If using docker, you need to link both containers in the same network, find whatever local IP kong is using (which occasionally changes), and then edit the hosts file in the container you want to connect from.

Additional context

The current solution also adds a bunch of unnecessary complexity (imo). My current mess (its bad i know, but its 3AM):

$api_key = 'some-api-key-probs-from-env';
$raw_domain = 'http://supabase.or.whatever';
$domain_but_exploded = explode('.', $raw_domain);

$scheme = explode('://', $raw_domain)[0]; // http
$reference_id = preg_replace('/https?:\/\//', '', $domain_but_exploded[0]); // supabase
$domain = $domain_but_exploded[1] . '.' . $domain_but_exploded[2]; // or.whatever
$StorageFile = new StorageFile($api_key, $reference_id, 'users', $domain, $scheme);

Could simply just be:

$api_key = 'some-api-key-probs-from-env';
$reference_id = 'http://supabase.or.whatever';
$StorageFile = new StorageFile($api_key, $reference_id, 'users');
// (A lazy but efficient:tm: solution could just be to check for `http(s)://` at the start of the reference_id)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.