Skip to content

Commit 8d683f8

Browse files
v0.0.1-alpha
1 parent 2263216 commit 8d683f8

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/Supabase/Supabase.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?php
22
namespace Supabase\Supabase;
3+
use Exception;
34

45
class Supabase
56
{
@@ -10,14 +11,14 @@ class Supabase
1011
protected $url;
1112
public $data;
1213

13-
public function __construct($url=null, $apikey=null)
14-
{
15-
16-
if (isset($url) && isset($apikey)) {
17-
$this->apikey = $apikey;
18-
$this->project_id = $url;
14+
public function __construct($url=null, $apikey=null){
15+
if (!isset($url)){
16+
throw new Exception("Supabase URL must be specified");
17+
} elseif(!isset($apikey)){
18+
throw new Exception("Supabase API_KEY must be specified", 1);
1919
} else {
20-
echo "Please provide Supabase full Details.\r\n";
20+
$this->apikey = $apikey;
21+
$this->project_id = $url;
2122
}
2223

2324
$URL = "$this->project_id/rest/v1/$this->table";

0 commit comments

Comments
 (0)