oo-money / oo-stripe-php
An enhanced, object-oriented wrapper for Stripe's PHP SDK, providing custom typed objects and convenient helper methods.
Requires
- stripe/stripe-php: ~10.16.0
Requires (Dev)
- phpunit/phpunit: 10.5.38
This package is auto-updated.
Last update: 2025-06-08 15:09:04 UTC
README
A lightweight PHP wrapper for Stripe's PHP SDK, providing an object-oriented interface for more readable and structured access to Stripe objects. oo-stripe-php
allows you to work with Stripe data in a more streamlined way by transforming raw data fields into useful objects, such as DateTime
.
Features
- Provides dynamic getters for Stripe properties, transforming specific fields into objects (e.g., timestamps to
DateTime
). - Uses traits for flexible and reusable getter transformations.
- Lightweight and focused on improving developer experience without altering underlying Stripe API behavior.
Usage
Dynamic Getters
The DynamicGetterTrait allows you to access properties dynamically, with the option to transform specific types (e.g., converting timestamps to DateTime).
// Assuming `created` is a timestamp, `getCreated` will return a DateTime object. $creationDate = $invoice->getCreated(); echo $creationDate->format('Y-m-d H:i:s');
API Documentation
For details on all available fields and methods, refer to the Stripe API documentation for each object type. oo-stripe-php aims to enhance the standard Stripe objects with a more object-oriented interface but otherwise mirrors the structure of Stripe’s SDK.
Contributing
Feel free to submit issues, fork the repository, and send pull requests. Please ensure that your contributions adhere to the existing code style and include relevant tests.
Running Tests
- Install dependencies, including PHPUnit:
composer install
- Run tests:
/vendor/bin/phpunit (or: make unit)
License
This project is licensed under the MIT License - see the LICENSE.md file for details.
Note: This project is not affiliated with Stripe, Inc. It’s a community-driven enhancement for developers using the Stripe PHP SDK.