palpalani / bayrewards-laravel
BayRewards PHP SDK for Laravel Framework - A comprehensive rewards platform integration for e-commerce stores.
Fund package maintenance!
palpalani
Installs: 7 888
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/palpalani/bayrewards-laravel
Requires
- php: ^8.3
- illuminate/contracts: ^11.0|^12.0
- saloonphp/saloon: ^3.14
- spatie/laravel-package-tools: ^1.92.7
Requires (Dev)
- larastan/larastan: ^3.8.0
- laravel/pint: ^1.25.1
- nunomaduro/collision: ^8.8.2|^9.0
- orchestra/testbench: ^10.6.0
- pestphp/pest: ^4.0|^5.0
- pestphp/pest-plugin-arch: ^4.0|^5.0
- pestphp/pest-plugin-laravel: ^4.0|^5.0
- phpstan/extension-installer: ^1.4.3
- phpstan/phpstan-deprecation-rules: ^1.2.1|^2.0
- phpstan/phpstan-phpunit: ^1.4.2|^2.0
Suggests
- ext-curl: Required for making HTTP requests to the BayRewards API
- ext-json: Required for JSON encoding and decoding
- dev-main
- v0.4.0
- 0.3.0
- 0.2.6
- 0.2.5
- 0.2.4
- 0.2.3
- 0.2.2
- 0.2.1
- 0.2.0
- 0.1.4
- 0.1.3
- 0.1.2
- 0.1.1
- 0.1.0
- dev-dependabot/composer/larastan/larastan-tw-3.8.0
- dev-dependabot/composer/orchestra/testbench-tw-10.6.0
- dev-dependabot/composer/saloonphp/saloon-tw-3.14
- dev-dependabot/composer/laravel/pint-tw-1.25.1
- dev-dependabot/composer/phpstan/extension-installer-tw-1.4.3
- dev-dependabot/composer/phpstan/phpstan-phpunit-tw-1.4.2
- dev-dependabot/composer/nunomaduro/collision-tw-8.8.2
- dev-dependabot/composer/spatie/laravel-package-tools-tw-1.92.7
- dev-dependabot/composer/phpstan/phpstan-deprecation-rules-tw-1.2.1
- dev-dependabot/github_actions/actions/checkout-5
- dev-feature/list
This package is auto-updated.
Last update: 2025-11-10 16:47:32 UTC
README
BayRewards PHP SDK for Laravel Framework.
BayRewards revolutionizes e-commerce engagement with a comprehensive rewards platform. Seamlessly integrated with online stores, BayRewards offers point programs, referral incentives, and VIP perks to drive customer loyalty and sales. Elevate your e-commerce experience by incentivizing purchases, encouraging referrals, and rewarding VIP customers with exclusive benefits. With BayRewards, businesses can effortlessly cultivate customer relationships and foster brand advocacy, leading to increased retention and revenue.
Table of Contents
- Requirements
- Installation
- Configuration
- Usage
- Testing
- Changelog
- Contributing
- Security Vulnerabilities
- Credits
- License
Requirements
- PHP >= 8.2
- Laravel >= 10.0 | >= 11.0 | >= 12.0
Installation
You can install the package via Composer:
composer require palpalani/bayrewards-laravel
The package will automatically register its service provider and facade.
Configuration
Publish the configuration file:
php artisan vendor:publish --tag="bayrewards-laravel-config"
This will create a config/bayrewards-laravel.php file in your config directory.
Environment Variables
Add the following to your .env file:
BAYREWARDS_BASE_URL=https://api.bayrewards.io
Replace the URL with your actual BayRewards API base URL.
Usage
Using the Facade
The package provides a BayRewards facade for easy access:
use Palpalani\BayRewards\Facades\BayRewards; $bayRewards = BayRewards::client();
Using Dependency Injection
You can also use dependency injection:
use Palpalani\BayRewards\BayRewards; class YourController { public function index() { $bayRewards = BayRewards::client(); // Use $bayRewards... } }
Get Store Details
Retrieve store details after integrating with BayRewards.io:
use Palpalani\BayRewards\Facades\BayRewards; $bayRewards = BayRewards::client(); $store = $bayRewards->storeDetails()->get('<Store-Access-Token>');
Get Store Features
Get available features for a store:
use Palpalani\BayRewards\Facades\BayRewards; $bayRewards = BayRewards::client(); $features = $bayRewards->getStoreFeatures()->get('<Store-Access-Token>');
Create Activity
Create a new BayRewards activity:
use Palpalani\BayRewards\Facades\BayRewards; $bayRewards = BayRewards::client(); $activity = $bayRewards->createActivity()->post('<Store-Access-Token>', [ 'title' => 'Purchase Reward', // Required 'icon' => 'https://example.com/icon.png', // Required ]);
Get Activity
Retrieve activity details:
use Palpalani\BayRewards\Facades\BayRewards; $bayRewards = BayRewards::client(); $activity = $bayRewards->getActivity()->get('<Store-Access-Token>', '<Activity-ID>');
Update Activity
Update an existing activity:
use Palpalani\BayRewards\Facades\BayRewards; $bayRewards = BayRewards::client(); $activity = $bayRewards->updateActivity()->post('<Store-Access-Token>', [ 'title' => 'Updated Purchase Reward', // Required 'icon' => 'https://example.com/updated-icon.png', // Required 'activity_id' => 12345, // Required ]);
Update Loyalty Points
Update loyalty points for a customer:
use Palpalani\BayRewards\Facades\BayRewards; $bayRewards = BayRewards::client(); $updatePoints = $bayRewards->updatePoints()->post('<Store-Access-Token>', [ 'activity_id' => 12345, // Required - from activity payload 'customer_email' => 'customer@example.com', // Required ]);
Get Store Customers
Retrieve all customers for a store with optional pagination and filtering:
use Palpalani\BayRewards\Facades\BayRewards; $bayRewards = BayRewards::client(); // Get all customers with default pagination $customers = $bayRewards->allCustomers()->get('<Store-Access-Token>'); // Get customers with custom pagination and filters $customers = $bayRewards->allCustomers()->get( '<Store-Access-Token>', // Required 1, // Optional - page number (default: 1) 25, // Optional - limit per page (default: 25) 'vip', // Optional - customer type filter (default: null) 'john' // Optional - search query (default: '') );
Testing
Run the tests with:
composer test
For test coverage:
composer test-coverage
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.