If you're developing a Laravel application and utilizing aMember Pro for subscription management, the plutuss/amember-pro-laravel package can be an invaluable tool. It offers a convenient interface for interacting with the aMember Pro API, simplifying the integration and management of users, products, payments, and other entities directly from your Laravel application.
📦 Installation
To install the package, run:
composer require plutuss/amember-pro-laravel
Then, publish the configuration file:
php artisan vendor:publish --provider="Plutuss\AMember\Providers\AMemberServiceProvider"
In your .env
file, add the following variables:
AMEMBER_URL=http://your-amember-site.com/api
AMEMBER_API_KEY=your_amember_api_key
AMEMBER_TYPE_RESPONSE=collection
🧰 Key Features
The package provides an AMember facade, enabling you to perform various operations:
- Users: Retrieve, add, and update user information.
- Invoices and Payments: Manage invoices and payments.
- Products: Access product listings.
- Authentication: Verify user login credentials.
- Affiliate Program: Manage affiliate data.
Example usage:
use Plutuss\AMember\Facades\AMember;
$users = AMember::users()->getUsers();
$invoice = AMember::invoice()->getInvoice(8);
$auth = AMember::auth()->byLoginPass('admin', '12341234');
You can also use the filter() method to filter data:
$filteredUsers = AMember::users()
->filter(['email' => 'user@example.com'])
->getUsers();
🛠 Example Controller
Here's how you might use the package within a controller:
use Plutuss\AMember\Facades\AMember;
class AMemberController extends Controller
{
public function listUsers()
{
$users = AMember::users()->getUsers();
return response()->json($users);
}
public function authenticate()
{
$auth = AMember::auth()->byLoginPass('admin', '12341234');
return response()->json($auth);
}
}
📚 Documentation and Resources
✅ Conclusion
The plutuss/amember-pro-laravel package significantly simplifies the integration of aMember Pro with Laravel, providing developers with a powerful tool for managing subscriptions and users. If you're seeking an efficient way to interact with the aMember API within your Laravel application, this package is an excellent choice.
Top comments (0)