This is Bamboocardportal.com package
vahidkaargar/bamboo-card-portal is a Laravel package for this is bamboocardportal.com package.
It currently has 17 GitHub stars and 2.601 downloads on Packagist (latest version v1.0.0).
Install it with composer require vahidkaargar/bamboo-card-portal.
Discover more Laravel packages by vahidkaargar
or browse all Laravel packages to compare alternatives.
Last updated
A professional Laravel package for seamless integration with the Bamboo Card Portal API. This package provides a robust, well-tested solution for interacting with Bamboo's services, featuring comprehensive exception handling, intelligent caching, Laravel facades, and extensive test coverage.
Install the package via Composer:
composer require vahidkaargar/bamboo-card-portal
Publish the configuration file:
php artisan vendor:publish --provider="vahidkaargar\BambooCardPortal\ServiceProviders\BambooServiceProvider" --tag="bamboo-config"
Configure your environment variables in .env:
# Sandbox Configuration
BAMBOO_SANDBOX_MODE=false
BAMBOO_SANDBOX_USERNAME=your_sandbox_username
BAMBOO_SANDBOX_PASSWORD=your_sandbox_password
# Production Configuration
BAMBOO_PRODUCTION_USERNAME=your_production_username
BAMBOO_PRODUCTION_PASSWORD=your_production_password
# Cache Configuration
BAMBOO_CACHE_ENABLED=false
BAMBOO_CACHE_DRIVER=default
BAMBOO_CACHE_PREFIX=bamboo
BAMBOO_CACHE_TTL=3600
# Connection Configuration
BAMBOO_CONNECTION_TIMEOUT=160
use Bamboo;
// All methods are available through the facade
$orders = Bamboo::orders()->get();
$catalogs = Bamboo::catalogs()->get();
$accounts = Bamboo::accounts()->get();
use vahidkaargar\BambooCardPortal\Bamboo;
$bamboo = new Bamboo();
// Or Helper
$bamboo = bamboo();
// Get orders
$orders = $bamboo->orders()
->setStartDate('2023-01-01')
->setEndDate('2023-01-31')
->get();
// Create order
$requestedId = Str::uuid();
$bamboo->orders()
->setRequestId($requestedId)
->setAccountId(123)
->setProducts([
["ProductId" => $productId, "Quantity" => $quantity, "Value" => $value],
["ProductId" => $productId2, "Quantity" => $quantity2, "Value" => $value2],
["ProductId" => $productId3, "Quantity" => $quantity3, "Value" => $value3],
])
->setProduct($productId4, $quantity4, $value4)
->checkout();
// Get specific order
$order = $bamboo->orders()->get($requestedId);
The package provides specific exceptions for different error scenarios:
use vahidkaargar\BambooCardPortal\Exceptions\{
AuthenticationException,
ConfigurationException,
NetworkException,
ResourceNotFoundException,
ValidationException
};
try {
$orders = $bamboo->orders()->get();
} catch (AuthenticationException $e) {
// Handle authentication errors
logger('Authentication failed: ' . $e->getMessage());
} catch (ResourceNotFoundException $e) {
// Handle resource not found errors
logger('Resource not found: ' . $e->getMessage());
} catch (ValidationException $e) {
// Handle validation errors
$errors = $e->getErrors();
logger('Validation errors: ' . json_encode($errors));
} catch (NetworkException $e) {
// Handle network errors
logger('Network error: ' . $e->getMessage());
}
The package includes intelligent caching functionality for all API endpoints:
// Cache is enabled by default for all endpoints
$orders = $bamboo->orders()->get(); // This will be cached
$catalogs = $bamboo->catalogs()->get(); // This will be cached
$accounts = $bamboo->accounts()->get(); // This will be cached
$transactions = $bamboo->transactions()->get(); // This will be cached
$exchange = $bamboo->exchange()->rate(); // This will be cached
// Disable caching in config
// BAMBOO_CACHE_ENABLED=false
// Use different cache driver
// BAMBOO_CACHE_DRIVER=redis
// Cache keys are automatically generated based on parameters
$catalogs->setCurrencyCode('USD')->setCountryCode('US')->get(); // Unique cache key
$transactions->setStartDate('2023-01-01')->setEndDate('2023-01-31')->get(); // Unique cache key
// config/bamboo.php
return [
'sandbox_mode' => env('BAMBOO_SANDBOX_MODE', false),
// Sandbox credentials
'sandbox_username' => env('BAMBOO_SANDBOX_USERNAME'),
'sandbox_password' => env('BAMBOO_SANDBOX_PASSWORD'),
'sandbox_base_url' => 'https://api-stage.bamboocardportal.com/api/integration/v1.0/',
// Production credentials
'production_username' => env('BAMBOO_PRODUCTION_USERNAME'),
'production_password' => env('BAMBOO_PRODUCTION_PASSWORD'),
'production_base_url' => 'https://api.bamboocardportal.com/api/integration/v1.0/',
'production_v2_base_url' => 'https://api.bamboocardportal.com/api/integration/v2.0/',
// Connection settings
'connection_timeout' => env('BAMBOO_CONNECTION_TIMEOUT', 160),
// Cache settings
'cache' => [
'enabled' => env('BAMBOO_CACHE_ENABLED', false),
'driver' => env('BAMBOO_CACHE_DRIVER', 'file'),
'prefix' => env('BAMBOO_CACHE_PREFIX', 'bamboo'),
'ttl' => env('BAMBOO_CACHE_TTL', 60),
],
];
$orders = $bamboo->orders();
// Get orders with date range
$orders->setStartDate('2023-01-01')
->setEndDate('2023-01-31')
->get();
// Create order
$requestedId = Str::uuid();
$orders->setRequestId($requestedId)
->setAccountId(123)
->setProduct(1, 5, 100)
->checkout();
// Get specific order
$orders->get($requestedId);
$catalogs = $bamboo->catalogs();
$products = $catalogs->get();
$accounts = $bamboo->accounts();
$account = $accounts->get();
$exchange = $bamboo->exchange();
$rates = $exchange->get();
$transactions = $bamboo->transactions()
->setStartDate('2022-05-02')
->setEndDate('2022-05-20')
->get();
$notifications = $bamboo->notifications();
$notification = $notifications->get();
Run the test suite:
composer test
The package includes comprehensive tests for:
BambooException: Base exception classAuthenticationException: Authentication failures (401)ConfigurationException: Configuration errorsNetworkException: Network/connection errorsResourceNotFoundException: Resource not found (404)ValidationException: Validation errors (422)The package supports various cache drivers and includes intelligent caching for all API endpoints:
array: Default in-memory cacheredis: Redis cachedatabase: Database cachefile: File-based cacheAll API endpoints are automatically cached with intelligent cache keys:
$exchange = $bamboo->exchange()
->setBaseCurrency('USD')
->setCurrency('EUR')
->rate(); // Cache key: exchange_rate_USD_EUR
$catalogs = $bamboo->catalogs()
->setVersion(2)
->setCurrencyCode('USD')
->setCountryCode('US')
->setPageSize(50)
->get(); // Cache key: catalog_2_{payload_hash}
$accounts = $bamboo->accounts()->get(); // Cache key: accounts
$transactions = $bamboo->transactions()
->setStartDate('2023-01-01')
->setEndDate('2023-01-31')
->get(); // Cache key: transactions_2023-01-01_2023-01-31
$orders = $bamboo->orders()
->setStartDate('2023-01-01')
->setEndDate('2023-01-31')
->get(); // Cache key: orders_2023-01-01_2023-01-31
We welcome contributions to improve this package. Please follow these steps:
git checkout -b feature/amazing-feature)composer test)git commit -m 'Add some amazing feature')git push origin feature/amazing-feature)This package is open-sourced software licensed under the MIT license.
For support and questions: