cierrateam / connect-laravel-sdk
Cierra Connect Laravel SDK
Installs: 2 089
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 3
Forks: 0
Open Issues: 0
Requires
- php: ^8.1
- cierrateam/connect-php-sdk: ^1
This package is auto-updated.
Last update: 2024-12-30 02:28:37 UTC
README
The Cierra Connect Laravel SDK provides an easy way to integrate with the Cierra Connect API in your Laravel applications.
Installation
Follow these steps to install and set up the package:
-
Install the package using Composer:
composer require cierrateam/connect-laravel-sdk
-
Add the service provider to your
config/app.php
file in theproviders
array:'providers' => [ // ... \Cierra\Connect\ConnectServiceProvider::class, ],
-
Publish the configuration file (optional):
php artisan vendor:publish --tag=cierra-connect-config
-
Add your Cierra Connect API key to your
.env
file:CIERRA_CONNECT_KEY=your_api_key_here
Replace 'your_api_key_here' with your actual Cierra Connect API key.
Usage Example
Here's an example of how you can use the Cierra Connect Laravel SDK in your controllers:
<?php namespace App\Http\Controllers; use Cierra\Connect\ConnectManager; use Illuminate\Http\Request; class TestCierraConnectController extends Controller { public function test(Request $request, ConnectManager $connectManager) { $CONNECTION = 'my_api_connection_key'; $apiClient = $connectManager->getInstance($CONNECTION); // Get a list of entities $items = $apiClient->entity('cars')->list(); dump($items); // Laravel collection returned dump($items->first()); // Pagination $items = $apiClient->entity('cars')->list(4, 100); dump($items); // Get specific item by ID $item = $apiClient->entity('cars')->get(314591); dump($item); // Get additional API response data $item = $apiClient->entity('cars')->asRawResponse()->get(314588); dump($item); } }