PHP code example of aungmyokyaw / lapakgaming

1. Go to this page and download the library: Download aungmyokyaw/lapakgaming 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/ */

    

aungmyokyaw / lapakgaming example snippets


$categories = LapakGaming::getCategories();

// Get all products in a category
$products = LapakGaming::getProductsByCategory('VAL');

// Get products in category for specific country
$products = LapakGaming::getProductsByCategory('VAL', 'id');

// Get products by product code
$products = LapakGaming::getProductsByCode('VAL1650-S14');

// Get products by code for specific country
$products = LapakGaming::getProductsByCode('VAL1650-S14', 'my');

// Filter by both category and product code
$products = LapakGaming::getProductsByCategoryAndCode('VAL', 'VAL1650-S14', 'id');

$allProducts = LapakGaming::getAllProducts();

// Get best products by category
$bestProducts = LapakGaming::getBestProductsByCategory('ML');

// Get best products by category for specific country
$bestProducts = LapakGaming::getBestProductsByCategory('ML', 'id');

// Get best products by group product code
$bestProducts = LapakGaming::getBestProductsByGroupCode('ML1288_166');

// Get best products by group code for specific country
$bestProducts = LapakGaming::getBestProductsByGroupCode('ML1288_166', 'my');

// Filter by both category and group product code
$bestProducts = LapakGaming::getBestProductsByCategoryAndGroupCode('ML', 'ML1288_166', 'id');

$balance = LapakGaming::getBalance();

// Simplest order - quantity defaults to 1
$order = LapakGaming::setProduct('ML78_8-S2')
                   ->setUser('123456789') // Game User ID
                   ->createOrder();

// For games requiring zone or server ID
$order = LapakGaming::setProduct('ML78_8-S2')
                   ->setUser('123456789', '2345') // User ID + Zone/Server ID
                   ->createOrder();

// For games requiring username
$order = LapakGaming::setProduct('ML78_8-S2')
                   ->setUser('123456789', '2345', 'additional_information') // User ID + Zone + Username
                   ->createOrder();

// Validate price to prevent order if price changed
$order = LapakGaming::setProduct('ML78_8-S2', 15000) // Product code + expected price
                   ->setUser('123456789', '2345', 'additional_information')
                   ->createOrder();

// Order multiple items
$order = LapakGaming::setProduct('ML78_8-S2')
                   ->setUser('123456789')
                   ->setQuantity(5) // Order 5 items
                   ->createOrder();

// Specify country for the order
$order = LapakGaming::setProduct('ML78_8-S2')
                   ->setUser('123456789')
                   ->setCountryCode('my') // Malaysia
                   ->createOrder();

// For games requiring login credentials
$order = LapakGaming::setProduct('LOGIN_GAME_PRODUCT')
                   ->setUser('123456789')
                   ->setOrderDetail('Password : mypass123 Nickname : PlayerOne Security code : 9876')
                   ->createOrder();

// Prevent duplicate orders with unique reference ID
$order = LapakGaming::setProduct('ML78_8-S2')
                   ->setUser('123456789')
                   ->setPartnerReferenceId('order-' . time()) // Unique reference
                   ->createOrder();

// Override default callback URL for this order
$order = LapakGaming::setProduct('ML78_8-S2')
                   ->setUser('123456789')
                   ->setCallbackUrl('https://yoursite.com/custom-callback') // Custom callback
                   ->createOrder();

// Order using group product instead of specific product code
$order = LapakGaming::setGroupProduct('mobile-legends')
                   ->setUser('123456789', '2345')
                   ->setCountryCode('id') // Indonesia
                   ->createOrder();

// Order with all possible parameters
$order = LapakGaming::setProduct('ML78_8-S2', 15000) // Product + price validation
                   ->setUser('123456789', '2345', 'additional_information') // Complete user info
                   ->setQuantity(2) // Multiple items
                   ->setCountryCode('my') // Malaysia
                   ->setOrderDetail('Password : 123 Nickname : nick Security code : 1234') // Login details
                   ->setPartnerReferenceId('unique-order-' . time()) // Idempotency
                   ->setCallbackUrl('https://yoursite.com/lapakgaming/callback') // Custom callback
                   ->createOrder();

// Check by transaction ID (tid)
$status = LapakGaming::checkOrderStatusByTid('RA171341142175668140');

// Check by partner reference ID
$status = LapakGaming::checkOrderStatusByRefId('R123');

// Check with both transaction ID and partner reference ID
$status = LapakGaming::checkOrderStatusByTidAndRefId('RA171341142175668140', 'R123');

// Check by transaction ID only
$status = LapakGaming::checkOrderStatusBy('RA171341142175668140');

// Check by partner reference ID only
$status = LapakGaming::checkOrderStatusBy(null, 'R123');

// Check by both
$status = LapakGaming::checkOrderStatusBy('RA171341142175668140', 'R123');
shell
php artisan vendor:publish --tag="lapakgaming-config"