mralston/bark-sdk is a Laravel package for php sdk for the bark api..
It currently has 0 GitHub stars and 15 downloads on Packagist (latest version v1.0.0).
Install it with composer require mralston/bark-sdk.
Discover more Laravel packages by mralston
or browse all Laravel packages to compare alternatives.
Last updated
This is PHP SDK for Bark. Bark is a world-leading services marketplace with over 5m customers in 8 countries around the world.
Visit the Bark website for more information.
You can install the package via composer:
composer require mralston/bark-sdk
use Mralston\Bark\Client;
use Mralston\Bark\Contact;
use Mralston\Bark\Flow;
// Log in
$client = new Client(
$client_id,
$secret,
$apiEndpoint
);
// Fetch all barks
foreach ($client->listBarks() as $bark) {
dump($bark);
}
Many of the objects exposed by the API support method chaining.
Configuration
In Laravel, you can publish the config file with:
php artisan vendor:publish --provider="Mralston\Bark\BarkServiceProvider" --tag="config"
This is the contents of the published config file:
return [
'client_id' => env('BARK_CLIENT_ID'),
'secret' => env('BARK_SECRET'),
'api_endpoint' => env('BARK_API_ENDPOINT'),
];
Configure the environment variables with your client ID, secret.
BARK_CLIENT_ID=
BARK_SECRET=
Dependency Injection
In addition to the method chaining described in the fluent API section above, the Laravel integration takes care of authentication automatically. All you need to do is grab an instance of the client from the container and start using it.
You can use dependency injection to get a pre-authenticated instance of the client:
use Illuminate\Http\Request;
use Mralston\Bark\Client;
class MyController
{
public function create(Request $request, Client $client)
{
// Create new contact using POST data
$barks = $client->listBarks(),
)
}
}
Alternatively, you can resolve an instance of the client from the container:
use Mralston\Bark\Client;
$client = app(Client::class);
Facade
In true Laravel tradition, you can also use a facade (along with method chaining, of course!).
use Mralston\Bark\Facades\Bark;
$barks = Bark::listBarks();
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.