PHP code example of tuefekci / deta

1. Go to this page and download the library: Download tuefekci/deta library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

tuefekci / deta example snippets


use tuefekci\deta\Deta;

$deta = new Deta('your_project_id', 'your_api_key');

use tuefekci\deta\Deta;
$deta = new Deta();

$my_base = $deta->base('my_base');

// Insert an item
$my_base->insert(['name' => 'Alice', 'age' => 30]);

// Get an item by key
$item = $my_base->get('abc123');

// Update an item
$my_base->update('abc123', ['name' => 'Bob']);

// Delete an item
$my_base->delete('abc123');

// Query items
$items = $my_base->query(['age' => ['lt' => 40]]);

$my_drive = $deta->drive('my_drive');

// Upload a file
$my_drive->put('file.txt', 'Hello, world!');

// Download a file
$content = $my_drive->get('file.txt');

// List files
$files = $my_drive->list();

use tuefekci\deta\Deta;
use tuefekci\deta\Base;
use tuefekci\deta\Drive;