PHP code example of seisigmasrl / lemonsqueezy-php
1. Go to this page and download the library: Download seisigmasrl/lemonsqueezy-php library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
seisigmasrl / lemonsqueezy-php example snippets
# Initializing the Package
ient
$client = new \LemonSqueezy\LemonSqueezy();
// Authenticate the client by providing your API Token which can be
// generated at https://app.lemonsqueezy.com/settings/api
$client->authenticate('yourApiToken');
# Initialize the Package from the step before
...
// Get the user information base on the defined in the Lemon Squeeze API Documentation
// https://docs.lemonsqueezy.com/api/users#the-user-object
$user = $client->user();
$userDetails = $user->getUserInformation();
var_dump($userDetails);
// object(LemonSqueezy\Entity\User)#4567 (7) {
// ["id"]=> id(5) "13546" // New
// ["name"]=> string(14) "Marco Polo"
// ["email"]=> string(19) "[email protected]"
// ["color"]=> string(7) "#7047EB"
// ["avatar_url"]=> string(72) "https://www.gravatar.com/avatar/cc27e9f9e9a66d0fb6a988a?d=blank"
// ["has_custom_avatar"]=> bool(false)
// ["createdAt"]=> string(27) "2023-01-18T13:56:46.000000Z"
// ["updatedAt"]=> string(27) "2023-01-18T14:00:01.000000Z"
// }
// Get only the ID of the User
// $userId = $user->getUserId(); Deprecated.
# Initialize the Package from the step before
...
// Get the user information base on the defined in the Lemon Squeeze API Documentation
// https://docs.lemonsqueezy.com/api/stores#the-store-object
$lemonSqueeze = $client->store();
$storeList = $lemonSqueeze->getAllStores(); // List all existing Stores
$store = $lemonSqueeze->getStore(12685); // Get details of the store with the ID: 12685
# Initialize the Package from the step before
...
// Get the user information base on the defined in the Lemon Squeeze API Documentation
// https://docs.lemonsqueezy.com/api/customers#the-customer-object
$lemonSqueeze = $client->customer();
$allCustomers = $lemonSqueeze->getAllCustomers(); // List all existing Customers
$storeCustomers = $lemonSqueeze->getStoreCustomers(12689); // List all customers from the Store ID: 12689
$customer = $lemonSqueeze->getCustomer(596510); // Get the details of the Customer with the ID: 596510
# Initialize the Package from the step before
...
// Get the user information base on the defined in the Lemon Squeeze API Documentation
// https://docs.lemonsqueezy.com/api/products#the-product-object
$lemonSqueeze = $client->product();
$allProducts = $lemonSqueeze->getAllProducts(); // List all existing Products
$storeCustomers = $lemonSqueeze->getStoreProducts(12689); // List all Products from the Store ID: 12689
$product = $lemonSqueeze->getProduct(59920); // Get the details of the Products with the ID: 59920
$productVariants = $lemonSqueeze->getProductVariants(59920); // Get all Variants from the Product ID: 59920
$productWithVariants = $lemonSqueeze->getProductWithVariants(59920); // Get a Product with All their Variants
bash
composer
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.