sooluh / papercups
Unofficial Papercups PHP library provides convenient access to the Papercups API from applications written in server-side PHP
dev-main
2023-05-24 06:24 UTC
Requires
- php: >=7.3
- guzzlehttp/guzzle: ^7.3.0
- league/mime-type-detection: dev-main
Requires (Dev)
- phpmd/phpmd: ^2.10
- squizlabs/php_codesniffer: ^3.6
This package is auto-updated.
Last update: 2024-12-24 09:29:55 UTC
README
Unofficial Papercups PHP library provides convenient access to the Papercups API from applications written in server-side PHP.
Requirements
- PHP >= 7.3
- Composer
Features
- PSR-4 autoloading compliant structure
- PSR-2 compliant code style
- Easy to use with any framework or even a plain php file
- Useful tools for better code included
Installation
Install the package with:
composer require sooluh/papercups
Usage
The package needs to be configured with an API key, which is available in the Papercups dashboard. Require the package with the key's value:
<?php // make sure composer dependencies have been installed require __DIR__ . '/vendor/autoload.php'; $papercups = new \Papercups\Client('PAPERCUPS_API_KEY'); $response = $papercups->messages()->create([ 'body' => 'Hello world!', 'conversation_id' => '...' ]); print_r($response);
If you're self-hosting Papercups on a different server, you can specify the API host:
$papercups = new \Papercups\Client('PAPERCUPS_API_KEY', 'https://papercups.mycompany.co');
License
Code licensed under MIT License.