1. Go to this page and download the library: Download geccomedia/weclapp 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/ */
geccomedia / weclapp example snippets
use Geccomedia\Weclapp\Models\Customer;
$customer = Customer::where('company', 'Your Company Name')
->firstOrFail();
namespace Your\Custom\Namespace;
use Geccomedia\Weclapp\Model;
class MyOrder extends Model
{
/**
* Override only when the class name doesn't match the API route.
*
* @var string
*/
protected $table = 'salesOrder';
}
$customer = new \Geccomedia\Weclapp\Models\Customer();
\Geccomedia\Weclapp\Models\Customer::unguard();
$customer->fill(['partyType' => 'ORGANIZATION']);
\Geccomedia\Weclapp\Models\Customer::reguard();
// 2 HTTP requests total: one for orders, one batched party lookup
$orders = SalesOrder::with('customer')->get();
foreach ($orders as $order) {
echo $order->customer->company;
}
$orders = SalesOrder::get(); // 1 request
foreach ($orders as $order) {
echo $order->customer->company; // 1 request per order
}
$customer = Customer::find('1');
$customer->salesOrders()->get(); // GET /salesOrder?customerId-eq=1
$customer->shipments()->get(); // GET /shipment?customerId-eq=1
$customer->quotations()->get(); // GET /quotation?customerId-eq=1
$customer->salesInvoices()->get(); // GET /salesInvoice?customerId-eq=1
$warehouse->warehouseStock()->get(); // GET /warehouseStock?warehouseId-eq=1
$salesOrder->shipments()->get(); // GET /shipment?salesOrderId-eq=1
$salesOrder->salesInvoices()->get(); // GET /salesInvoice?salesOrderId-eq=1
$article->articlePrices()->get(); // GET /articlePrice?articleId-eq=1
$supplier->purchaseOrders()->get(); // GET /purchaseOrder?supplierId-eq=1
// Includes the orderItems and tags fields in the response
$orders = SalesOrder::withProperties('orderItems', 'tags')->get();
// → GET /salesOrder?additionalProperties=orderItems,tags
use Geccomedia\Weclapp\WeclappApiException;
try {
$invoice->save();
} catch (WeclappApiException $e) {
// Plain string message — safe to log
Log::error($e->getMessage());
// Scalar context is available if you need it
$e->getRequestMethod(); // e.g. 'POST'
$e->getRequestUri(); // e.g. 'https://...weclapp.com/webapp/api/v1/salesInvoice'
$e->getResponseStatus(); // e.g. 422
$e->getResponseBody(); // raw response body string
}
use Geccomedia\Weclapp\Connection;
app(Connection::class)->enableQueryLog();
\Geccomedia\Weclapp\Models\Customer::create(['name' => 'Test']);
app(Connection::class)->getQueryLog();
// GET /party?customer-eq=true&company-eq=Acme&pageSize=100
$customers = Customer::where('company', 'Acme')->get();
// GET /party?supplier-eq=true&pageSize=100
$suppliers = Supplier::all();
// GET /party?leadStatus-notnull=&leadStatus-ne=CONVERTED&pageSize=100
$leads = Lead::all();
// GET /party?partyType-eq=PERSON&pageSize=100
$contacts = Contact::all();
// GET /party?customer-eq=true&...
Customer::where('customer', true)->get();
// GET /party?customerBlocked-eq=false&...
Customer::where('customerBlocked', false)->get();
// GET /article?active-in=["true","false"]&...
Article::whereIn('active', [true, false])->get();
use Geccomedia\Weclapp\SystemApi;
$api = app(SystemApi::class);
// GET /system/permissions → string[]
// Returns the permission slugs granted to the current API key.
$permissions = $api->permissions();
// e.g. ['party:read', 'salesOrder:read', 'salesOrder:write', ...]
// GET /system/licenses → array of {name: string, permissions: string[]}
// Returns the active licence modules and their reset: 'NONE', 'PROD_SYSTEM', or 'TEMPLATE_SYSTEM'.
$api->createDemoTestSystem('My Test System', 'PROD_SYSTEM');
$api->createDemoTestSystem('My Test System', 'PROD_SYSTEM', allUsers: true);
use Geccomedia\Weclapp\JobApi;
$api = app(JobApi::class);
// GET /job/status?type=INVENTORY_BOOKING
// Returns the current status and progress of the named background job.
$status = $api->status('INVENTORY_BOOKING');
// e.g. ['type' => 'INVENTORY_BOOKING', 'status' => 'EXECUTING', 'progress' => ['current' => 42, 'total' => 100]]
// GET /job/abort?type=INVENTORY_BOOKING
// Requests cancellation of a running job.
$result = $api->abort('INVENTORY_BOOKING');
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.