Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Supabaseって何?PHPから触ってみる / What is Supabase, and how to touch it from PHP?

Supabaseって何?PHPから触ってみる / What is Supabase, and how to touch it from PHP?

(非公式)PHPカンファレンス沖縄2023前夜祭LT会
https://re-build.connpass.com/event/291268/

shiro seike

September 15, 2023
Tweet

More Decks by shiro seike

Other Decks in Programming

Transcript

  1. Supabase PHP
    (

    )PHP 2023 LT
    2
    0
    23
    .
    9
    .
    15
    @seike
    4
    60
    1

    View full-size slide

  2. 自己
    @seike
    46
    0
    -
    - @seike
    46
    0
    - AWS Community Builder Serverless
    - Fusic
    - /

    - /
    -
    - PHP
    - PHP
    - PHP
    -
    - PHP 2023
    行 長
    - Fukuoka.php Organizer
    2

    View full-size slide

  3. Agenda
    1
    .Supabase
    2
    .PHP
    用方
    3
    .Supabase x Bref
    3

    View full-size slide

  4. Supabase
    PostgreSQL
    Supabase PostgreSQL
    Google GitHub Facebook

    API
    SQL RESTful API
    自 行
    一 自 行
    GitHub

    5

    View full-size slide


  5. Client OSS
    Composer
    PostgREST
    PostgreSQL

    RESTful API
    自 生
    7
    $ composer require supabase/postgrest-php

    View full-size slide


  6.  
    ORM
     
    8

    View full-size slide

  7. 03
    Supabase x Bref

    View full-size slide

  8. Bref
    PHP Custom Runtime
    - Serverless Framework

    - AWS Serverless Application Model(SAM)

    - Docker Image DockerHub

    DockerCompose
    10

    View full-size slide

  9. Developer Community
    AWS Lambda

    PHP

    PHP Deploy

    PHPer

    Bref

    11
    service: app-supabase
    provider:
    name: aws
    region: ap-northeast-
    1
    plugins:
    - ./vendor/bref/bref
    functions:
    api:
    handler: index.php
    description: ''
    runtime: php-
    8
    2
    -fpm
    timeout:
    28
    # in seconds (API Gateway has a timeout
    of
    29
    seconds)
    events:
    - httpApi: '*'
    # Exclude files from deployment
    package:
    patterns:
    - '!node_modules/**'
    - '!tests/**'
    $ composer require bref/bref
    $ vendor/bin/bref init

    View full-size slide

  10. 13
    $ ab -n
    1 0
    0 0
    -c
    1 00
    https://rznktx
    2
    jhi.execute-api.ap-northeast-
    1
    .amazonaws.com/
    This is ApacheBench, Version
    2
    .
    3
    <$Revision:
    1
    90
    3 6
    18
    $>
    Copyright
    1996
    Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
    Licensed to The Apache Software Foundation, http://www.apache.org/
    Benchmarking rznktx
    2
    jhi.execute-api.ap-northeast-
    1
    .amazonaws.com (be patient)
    Completed
    100 0
    requests
    Finished
    100 0
    requests
    Server Software:
    Server Hostname: rznktx
    2
    jhi.execute-api.ap-northeast-
    1
    .amazonaws.com
    Server Port:
    44 3
    SSL/TLS Protocol: TLSv
    1
    .
    2
    ,ECDHE-RSA-AES
    1
    2 8
    -GCM-SHA
    2
    56
    ,
    20
    4 8
    ,
    12
    8
    Server Temp Key: ECDH P-
    25
    6 2
    56
    bits
    TLS Server Name: rznktx
    2
    jhi.execute-api.ap-northeast-
    1
    .amazonaws.com
    Document Path: /
    Document Length:
    8
    6 0
    bytes
    Concurrency Level:
    10 0
    Time taken for tests:
    4
    .
    7
    9 0
    seconds
    Complete requests:
    1 0
    0 0
    Failed requests:
    0
    Total transferred:
    10 57
    0 00
    bytes
    HTML transferred:
    860 0
    0 0
    bytes
    Requests per second:
    2 08
    .
    78
    [#/sec] (mean)
    Time per request:
    478
    .
    9 7
    0
    [ms] (mean)
    Time per request:
    4
    .
    7 90
    [ms] (mean, across all concurrent requests)
    Transfer rate:
    21 5
    .
    51
    [Kbytes/sec] received
    Connection Times (ms)
    min mean[+/-sd] median max
    Connect:
    10 1 141 4
    0
    .
    0 120 3
    67
    Processing:
    1 61 2 56 1 54
    .
    6 20
    0 1
    16
    3
    Waiting:
    1 6
    1 2 5
    5 15 4
    .
    0 20
    0 11
    63
    Total:
    275 3 97 1 6
    5
    .
    7 3 45 13
    42
    Percentage of the requests served within a certain time (ms)
    5
    0
    %
    3 4
    5
    6
    6
    %
    3 8
    4
    7
    5
    %
    3 9
    6
    8
    0
    %
    4 0
    8
    9
    0
    %
    5 3
    1
    9
    5
    %
    7 9
    9
    9
    8
    %
    1056
    9
    9
    %
    1060
    1
    00
    %
    1
    3
    42
    (longest request)

    View full-size slide


  11. 11:20 TRACK A
    16

    View full-size slide

  12. Thank You
    We are Hiring !
    https://recruit.fusic.co.jp/

    View full-size slide