PHP code example of asorasoft / bill

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

    

asorasoft / bill example snippets




'providers' => [
    
    Asorasoft\Bill\BillServiceProvider::class
]

public function createOrUpdateCustomer()
{
    Customer::updateOrCreate([
        'customer_id' => $customer_id,
        'name' => 'Name',
        'phone' => '019000000',
        'email' => '[email protected]'
    ]);
}

public function getCustomerAndPlans() 
{
    $get_customer_and_plans = Subscription::getCustomerAndPlans($customer_id);
    
    return json_encode($get_customer_and_plans);
}

public function subscribe()
{
    Subscription::subscribe($customer_id, $plan_id);
}

public function changePlanRequest()
{
    $this->validate($request, [
        'from_plan_id' => 'ed',
        'document' => '    ['name' => 'from_plan_id', 'contents' => $request->from_plan_id],
        ['name' => 'to_plan_id', 'contents' => $request->to_plan_id],
        ['name' => 'duration', 'contents' => $request->duration],
        ['name' => 'price', 'contents' => $request->price],
        [
            'name' => 'document',
            'contents' => fopen($request->document->path(), 'r'),
            'filename' => $request->document->getClientOriginalName(),
            'Mime-Type' => $request->document->getClientMimeType()
        ],
    ]);

    return json_encode($response);
}

public function renewalPlanRequest()
{
    $this->validate($request, [
        'price' => 'onse = RenewalPlanRequest::create([
        ['name' => 'customer_id', 'contents' => $customer_id],
        ['name' => 'duration', 'contents' => $request->duration],
        ['name' => 'price', 'contents' => $request->price],
        [
            'name' => 'document',
            'contents' => fopen($request->document->path(), 'r'),
            'filename' => $request->document->getClientOriginalName(),
            'Mime-Type' => $request->document->getClientMimeType()
        ],
    ]);
    
    return json_encode($response);
}

public function invoices()
{
    $response = Invoice::list($customer_id);

    return json_encode($response);
}

public function download()
{
    return Invoice::download($invoice_uuid);
}
bash
php artisan vendor:publish --provider="Asorasoft\Bill\BillServiceProvider"