定制 supabase-php/supabase-client 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

supabase-php/supabase-client

Composer 安装命令:

composer require supabase-php/supabase-client

包简介

Supabase client for PHP.

README 文档

README

Supabase

Packagist Downloads GitHub Release GitHub License Packagist Dependency Version

Supabase client for PHP:

  • Realtime database, Storage, Authentication and many more.
  • When you creating your supabase table, make sure RLS (Row Level Security) option be disable.
  • If RLS are enable maybe you getting some errors.

Warning

if you push the code to production while Row-Level Security (RLS) is disabled, it can pose a security threat to your application. To secure your app, please enable Row-Level Security. Otherwise, write an Object-Oriented PDO connection with PostgreSQL.

Env config code:

HOST=aws-o-ap-south-pool.supabase.com
PORT=6543
USERNAME=postgres.grufgrcytvrh
PASSWORD=[Your Password]
DATABASE=postgres

Install

  • Install Supabase client for our project.
  • Than we are require supabase-client by composer.
composer require supabase-php/supabase-client      # letest
# OR Downloads old version
composer require supabase-php/supabase-client:"1.0.4"

Config

Supabase client for PHP configuration with your php project/web Apps.

use Supabase\Functions as Supabase;

// autoload the supabase class
require_once('vendor/autoload.php');

// config
$config = [
  'url' => $_ENV['SB_URL'],
  # 'apikey' => $_ENV['SB_APIKEY'],
  'service_role' => $_ENV['SB_SERVICE_ROLE'] # If don't want disable RLS 
];

$client = new Supabase($config['url'], $config['apikey']);

if you did not have .env file so please create your .env file.

touch .env

if you create already your .env file then you will be derclare your enviroment variables names.

vi .env
SB_URL=https://rurtighghurtuhouger.supabase.co
SB_API_KEY=utertu895tyut8trrvt8rtu8mutt84r548t894v98v5vtt6ut54uu85tu

getAllData()

if you want to get all recorded data from your table when you saved the data then used getAllData function.

$data = $client->getAllData('table name');
print_r($data);

getSingleData()

if you need a specifics data from specifics columns then you used getSingleData function.

$data = $client->getSingleData('table name', 'column name');
print_r($data);

postData()

if you want to save your data to your table then used postData function.

// posted data
$data = [
  'name' => 'PHP',
  'version' => '8.3'
];

$client->postData('table name', $data, 'id');
// 3rd option on_conflict

updateData()

if you thinks something to be wrong or outdated so you will be changing that particular value from particular columns and also you updating all the data. Then used updateData function.

// updated data
$data = [
  'name' => 'PHP',
  'version' => '8.4'
];

$client->updateData('table name', 'id number', $data);

deleteData()

if you want to Delete a specificed data from the table, then used deleteData function. you needed the id number of table data.

$client->deleteData('table name', 2 //id);

Pagination()

$client->pages('table name');

Filtering()

$client->filter('table name', 1);

Matching()

$data = [
  'name' => 'PHP',
  'version' => '8.4'
];

$client->matchs('table name', $data);

Contributors

supabase-php/supabase-client 适用场景与选型建议

supabase-php/supabase-client 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2.09k 次下载、GitHub Stars 达 7, 最近一次更新时间为 2024 年 08 月 17 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「supabase」 「supabase-php」 「supabase-client」 「supabase-sdk」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 supabase-php/supabase-client 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 supabase-php/supabase-client 我们能提供哪些服务?
定制开发 / 二次开发

基于 supabase-php/supabase-client 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 2.09k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 9
  • 点击次数: 9
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 7
  • Watchers: 2
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-08-17