Official PHP SDK for S.EE API, providing easy access to URL shortening, text pasting, and file services.
- PHP >= 8.1
- Guzzle >= 7.0
Install via Composer:
composer require sdotee/sdkor visit: https://packagist.org/packages/sdotee/sdk for more details.
use See\Client;
$apiKey = 'YOUR_API_KEY';
$client = new Client($apiKey);Create a Short URL:
try {
$result = $client->shortUrl->create('https://example.com/long/url', 's.ee', [
'custom_slug' => 'myshort',
'title' => 'My Link'
]);
echo "Short URL: " . $result['short_url'];
} catch (\See\Exception\SeeException $e) {
echo "Error: " . $e->getMessage();
}Update a Short URL:
$client->shortUrl->update('s.ee', 'myshort', 'https://new-url.com', 'New Title');Delete a Short URL:
$client->shortUrl->delete('s.ee', 'myshort');Create Text Paste:
$result = $client->text->create('Hello World!', [
'text_type' => 'markdown',
'title' => 'My Note'
]);
echo $result['short_url'];Update Text Paste:
$client->text->update('s.ee', 'myslug', 'New Content', 'New Title');Delete Text Paste:
$client->text->delete('s.ee', 'myslug');Upload File:
// Upload from path
$result = $client->file->upload('/path/to/image.png', 'image.png');
echo $result['url'];
echo $result['delete']; // Delete keyDelete File:
$client->file->delete($deleteKey);Get Available Domains:
$domains = $client->common->getDomains();
print_r($domains);Get Tags:
$tags = $client->common->getTags();
print_r($tags);There are example scripts in the examples/ directory demonstrating how to use different services.
To run the examples, you need to set the SEE_API_KEY environment variable. Optionally, you can set SEE_API_BASE if you need to use a different API endpoint.
Short URL Example:
export SEE_API_KEY="your_api_key"
php examples/url.phpText Paste Example:
export SEE_API_KEY="your_api_key"
php examples/text.phpFile Service Example:
export SEE_API_KEY="your_api_key"
php examples/file.phpThe project includes PHPUnit tests for each service module (ShortUrl, Text, File).
Run all unit tests:
./vendor/bin/phpunitRun tests for a specific module:
# Test Short URL service
./vendor/bin/phpunit tests/ShortUrlTest.php
# Test Text service
./vendor/bin/phpunit tests/TextTest.php
# Test File service
./vendor/bin/phpunit tests/FileTest.phpThis project is licensed under the MIT License. See the LICENSE file for details.