PHPackages                             gdinko/prim - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. gdinko/prim

ActiveLibrary[API Development](/categories/api)

gdinko/prim
===========

Laravel Prim API Wrapper

v1.0.13(3mo ago)33.6k↓41.7%MITPHPPHP ^7.4|^8.0|^8.1|^8.2|^8.3|^8.4|^8.5CI passing

Since Oct 11Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/gdinko/prim)[ Packagist](https://packagist.org/packages/gdinko/prim)[ Docs](https://github.com/gdinko/prim)[ RSS](/packages/gdinko-prim/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (11)Versions (15)Used By (0)

Laravel Prim API Wrapper
========================

[](#laravel-prim-api-wrapper)

[![Latest Version on Packagist](https://camo.githubusercontent.com/436419d447630e48365ee5d83f390a70145f02619b67e72dd76eae38245d19dc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6764696e6b6f2f7072696d2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/gdinko/prim)[![GitHub Tests Action Status](https://camo.githubusercontent.com/3b1d64d6b1d9402e2bd711f142ddcb2fa9caf36c1fb6e7491ab6ebd44e6d7ef6/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6764696e6b6f2f7072696d2f72756e2d74657374732e796d6c3f6c6162656c3d7465737473)](https://github.com/gdinko/prim/actions?query=workflow%3Arun-tests+branch%3Amaster)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/2630fad72f90af71450a82033bc7ad168daa37cc3e2b01e1242ffb3bea164383/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6764696e6b6f2f7072696d2f7068702d63732d66697865722e796d6c3f6c6162656c3d636f64652532307374796c65)](https://github.com/gdinko/prim/actions?query=workflow%3A%22Check+%26+fix+styling%22+branch%3Amaster)[![Total Downloads](https://camo.githubusercontent.com/bd5e15681a919ac783998b1066e3aab651b983593d07ec1ba7a588120f3be3af/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6764696e6b6f2f7072696d2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/gdinko/prim)

[Prim JSON API Documentation](https://prim.bg)

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require gdinko/prim
```

If you plan to use database for storing request / error logs:

```
php artisan migrate --step
```

If you need to export configuration file:

```
php artisan vendor:publish --tag=prim-config
```

If you need to export migrations:

```
php artisan vendor:publish --tag=prim-migrations
```

If you need to export models:

```
php artisan vendor:publish --tag=prim-models
```

If you need to export commands:

```
php artisan vendor:publish --tag=prim-commands
```

Configuration
-------------

[](#configuration)

Add this to .env file:

```
PRIM_API_TOKEN= #Get API token from prim.bg
PRIM_API_BASE_URL=  #Get API Base URL from prim.bg
PRIM_API_TIMEOUT= #default 30
PRIM_ENABLE_REQUEST_LOG=true/false #default false | log every request/response in database
PRIM_ENABLE_ERROR_LOG=true/false #default true | log every error response in database
```

Usage
-----

[](#usage)

### Runtime Setup

[](#runtime-setup)

```
Prim::setApiToken('token');
Prim::getApiToken();
Prim::setBaseUrl('endpoint');
Prim::getBaseUrl();
Prim::setTimeout(99);
Prim::getTimeout();
Prim::enableRequestLog();
Prim::disableRequestLog();
Prim::enableErrorLog();
Prim::disableErrorLog();
```

### Methods

[](#methods)

```
//list all API methods and params
Prim::getAllMethods(): array

//get info about method params
Prim::getMethodParams($method, $verb): array

//auto generate validation rules for API method
Prim::getValidationRules($method, $verb): array

//make call to custom METHOD
Prim::public function customMethod(string $methodName, PrimRequestInterface $request, string $verb = 'post', $wantAll = false)

/**
* getAccounts
*
* Prim Endpoint: RPC.common.Api.Accounts.get
*
*
* @param \Gdinko\Prim\Interfaces\PrimRequestInterface $request
* @param boolean $wantAll
* @return array
*
* @throws \Gdinko\Prim\Exceptions\PrimException
* @throws \Gdinko\Prim\Exceptions\PrimValidationException
*/
Prim::getAccounts(PrimRequestInterface $request, $wantAll = false): array

/**
* setAddresses
*
* Prim Endpoint: RPC.common.Api.Addresses.set
*
*
* @param \Gdinko\Prim\Interfaces\PrimRequestInterface $request
* @param boolean $wantAll
* @return array
*
* @throws \Gdinko\Prim\Exceptions\PrimException
* @throws \Gdinko\Prim\Exceptions\PrimValidationException
*/
Prim::setAddresses(PrimRequestInterface $request, $wantAll = false): array

/**
* getExpenseAllocations
*
* Prim Endpoint: RPC.common.Api.Allocations.getExpense
*
*
* @param \Gdinko\Prim\Interfaces\PrimRequestInterface $request
* @param boolean $wantAll
* @return array
*
* @throws \Gdinko\Prim\Exceptions\PrimException
* @throws \Gdinko\Prim\Exceptions\PrimValidationException
*/
Prim::getExpenseAllocations(PrimRequestInterface $request, $wantAll = false): array

/**
* getAvailabilities
*
* Prim Endpoint: RPC.common.Api.Availabilities.get
*
*
* @param \Gdinko\Prim\Interfaces\PrimRequestInterface $request
* @param boolean $wantAll
* @return array
*
* @throws \Gdinko\Prim\Exceptions\PrimException
* @throws \Gdinko\Prim\Exceptions\PrimValidationException
*/
Prim::getAvailabilities(PrimRequestInterface $request, $wantAll = false): array

/**
* getAvailabilitiesByLabels
*
* Prim Endpoint: RPC.common.Api.AvailabilitiesByLabels.get
*
*
* @param \Gdinko\Prim\Interfaces\PrimRequestInterface $request
* @param boolean $wantAll
* @return array
*
* @throws \Gdinko\Prim\Exceptions\PrimException
* @throws \Gdinko\Prim\Exceptions\PrimValidationException
*/
Prim::getAvailabilitiesByLabels(PrimRequestInterface $request, $wantAll = false): array

/**
* getBlanks
*
* Prim Endpoint: RPC.common.Api.Blanks.get
*
*
* @param \Gdinko\Prim\Interfaces\PrimRequestInterface $request
* @param boolean $wantAll
* @return array
*
* @throws \Gdinko\Prim\Exceptions\PrimException
* @throws \Gdinko\Prim\Exceptions\PrimValidationException
*/
Prim::getBlanks(PrimRequestInterface $request, $wantAll = false): array

/**
* getBonusPoints
*
* Prim Endpoint: RPC.common.Api.BonusPoints.get
*
*
* @param \Gdinko\Prim\Interfaces\PrimRequestInterface $request
* @param boolean $wantAll
* @return array
*
* @throws \Gdinko\Prim\Exceptions\PrimException
* @throws \Gdinko\Prim\Exceptions\PrimValidationException
*/
Prim::getBonusPoints(PrimRequestInterface $request, $wantAll = false): array

/**
* setBrands
*
* Prim Endpoint: RPC.common.Api.Brands.set
*
*
* @param \Gdinko\Prim\Interfaces\PrimRequestInterface $request
* @param boolean $wantAll
* @return array
*
* @throws \Gdinko\Prim\Exceptions\PrimException
* @throws \Gdinko\Prim\Exceptions\PrimValidationException
*/
Prim::setBrands(PrimRequestInterface $request, $wantAll = false): array

/**
* getClientTypes
*
* Prim Endpoint: RPC.common.Api.ClientTypes.get
*
*
* @param \Gdinko\Prim\Interfaces\PrimRequestInterface $request
* @param boolean $wantAll
* @return array
*
* @throws \Gdinko\Prim\Exceptions\PrimException
* @throws \Gdinko\Prim\Exceptions\PrimValidationException
*/
Prim::getClientTypes(PrimRequestInterface $request, $wantAll = false): array

/**
* setContacts
*
* Prim Endpoint: RPC.common.Api.Contacts.set
*
*
* @param \Gdinko\Prim\Interfaces\PrimRequestInterface $request
* @param boolean $wantAll
* @return array
*
* @throws \Gdinko\Prim\Exceptions\PrimException
* @throws \Gdinko\Prim\Exceptions\PrimValidationException
*/
Prim::setContacts(PrimRequestInterface $request, $wantAll = false): array

/**
* getCurrencies
*
* Prim Endpoint: RPC.common.Api.Currencies.get
*
*
* @param \Gdinko\Prim\Interfaces\PrimRequestInterface $request
* @param boolean $wantAll
* @return array
*
* @throws \Gdinko\Prim\Exceptions\PrimException
* @throws \Gdinko\Prim\Exceptions\PrimValidationException
*/
Prim::getCurrencies(PrimRequestInterface $request, $wantAll = false): array

/**
* getDeliveryTypes
*
* Prim Endpoint: RPC.common.Api.DeliveryTypes.get
*
*
* @param \Gdinko\Prim\Interfaces\PrimRequestInterface $request
* @param boolean $wantAll
* @return array
*
* @throws \Gdinko\Prim\Exceptions\PrimException
* @throws \Gdinko\Prim\Exceptions\PrimValidationException
*/
Prim::getDeliveryTypes(PrimRequestInterface $request, $wantAll = false): array

/**
* getDocInfo
*
* Prim Endpoint: RPC.common.Api.DocInfo.get
*
*
* @param \Gdinko\Prim\Interfaces\PrimRequestInterface $request
* @param boolean $wantAll
* @return array
*
* @throws \Gdinko\Prim\Exceptions\PrimException
* @throws \Gdinko\Prim\Exceptions\PrimValidationException
*/
Prim::getDocInfo(PrimRequestInterface $request, $wantAll = false): array

/**
* getFiles
*
* Prim Endpoint: RPC.common.Api.Files.get
*
*
* @param \Gdinko\Prim\Interfaces\PrimRequestInterface $request
* @param boolean $wantAll
* @return array
*
* @throws \Gdinko\Prim\Exceptions\PrimException
* @throws \Gdinko\Prim\Exceptions\PrimValidationException
*/
Prim::getFiles(PrimRequestInterface $request, $wantAll = false): array

/**
* annulFinDocFinDoc
*
* Prim Endpoint: RPC.common.Api.FinDoc.annulFinDoc
*
*
* @param \Gdinko\Prim\Interfaces\PrimRequestInterface $request
* @param boolean $wantAll
* @return array
*
* @throws \Gdinko\Prim\Exceptions\PrimException
* @throws \Gdinko\Prim\Exceptions\PrimValidationException
*/
Prim::annulFinDocFinDoc(PrimRequestInterface $request, $wantAll = false): array

/**
* setGroups
*
* Prim Endpoint: RPC.common.Api.Groups.set
*
*
* @param \Gdinko\Prim\Interfaces\PrimRequestInterface $request
* @param boolean $wantAll
* @return array
*
* @throws \Gdinko\Prim\Exceptions\PrimException
* @throws \Gdinko\Prim\Exceptions\PrimValidationException
*/
Prim::setGroups(PrimRequestInterface $request, $wantAll = false): array

/**
* getInterationSystems
*
* Prim Endpoint: RPC.common.Api.InterationSystems.get
*
*
* @param \Gdinko\Prim\Interfaces\PrimRequestInterface $request
* @param boolean $wantAll
* @return array
*
* @throws \Gdinko\Prim\Exceptions\PrimException
* @throws \Gdinko\Prim\Exceptions\PrimValidationException
*/
Prim::getInterationSystems(PrimRequestInterface $request, $wantAll = false): array

/**
* setInvoice
*
* Prim Endpoint: RPC.common.Api.Invoice.set
*
*
* @param \Gdinko\Prim\Interfaces\PrimRequestInterface $request
* @param boolean $wantAll
* @return array
*
* @throws \Gdinko\Prim\Exceptions\PrimException
* @throws \Gdinko\Prim\Exceptions\PrimValidationException
*/
Prim::setInvoice(PrimRequestInterface $request, $wantAll = false): array

/**
* setItems
*
* Prim Endpoint: RPC.common.Api.Items.set
*
*
* @param \Gdinko\Prim\Interfaces\PrimRequestInterface $request
* @param boolean $wantAll
* @return array
*
* @throws \Gdinko\Prim\Exceptions\PrimException
* @throws \Gdinko\Prim\Exceptions\PrimValidationException
*/
Prim::setItems(PrimRequestInterface $request, $wantAll = false): array

/**
* getListOperation
*
* Prim Endpoint: RPC.common.Api.ListOperation.get
*
*
* @param \Gdinko\Prim\Interfaces\PrimRequestInterface $request
* @param boolean $wantAll
* @return array
*
* @throws \Gdinko\Prim\Exceptions\PrimException
* @throws \Gdinko\Prim\Exceptions\PrimValidationException
*/
Prim::getListOperation(PrimRequestInterface $request, $wantAll = false): array

/**
* setMeasures
*
* Prim Endpoint: RPC.common.Api.Measures.set
*
*
* @param \Gdinko\Prim\Interfaces\PrimRequestInterface $request
* @param boolean $wantAll
* @return array
*
* @throws \Gdinko\Prim\Exceptions\PrimException
* @throws \Gdinko\Prim\Exceptions\PrimValidationException
*/
Prim::setMeasures(PrimRequestInterface $request, $wantAll = false): array

/**
* getOperations
*
* Prim Endpoint: RPC.common.Api.Operations.get
*
*
* @param \Gdinko\Prim\Interfaces\PrimRequestInterface $request
* @param boolean $wantAll
* @return array
*
* @throws \Gdinko\Prim\Exceptions\PrimException
* @throws \Gdinko\Prim\Exceptions\PrimValidationException
*/
Prim::getOperations(PrimRequestInterface $request, $wantAll = false): array

/**
* getParams
*
* Prim Endpoint: RPC.common.Api.Params.get
*
*
* @param \Gdinko\Prim\Interfaces\PrimRequestInterface $request
* @param boolean $wantAll
* @return array
*
* @throws \Gdinko\Prim\Exceptions\PrimException
* @throws \Gdinko\Prim\Exceptions\PrimValidationException
*/
Prim::getParams(PrimRequestInterface $request, $wantAll = false): array

/**
* setPartners
*
* Prim Endpoint: RPC.common.Api.Partners.set
*
*
* @param \Gdinko\Prim\Interfaces\PrimRequestInterface $request
* @param boolean $wantAll
* @return array
*
* @throws \Gdinko\Prim\Exceptions\PrimException
* @throws \Gdinko\Prim\Exceptions\PrimValidationException
*/
Prim::setPartners(PrimRequestInterface $request, $wantAll = false): array

/**
* getPayTypes
*
* Prim Endpoint: RPC.common.Api.PayTypes.get
*
*
* @param \Gdinko\Prim\Interfaces\PrimRequestInterface $request
* @param boolean $wantAll
* @return array
*
* @throws \Gdinko\Prim\Exceptions\PrimException
* @throws \Gdinko\Prim\Exceptions\PrimValidationException
*/
Prim::getPayTypes(PrimRequestInterface $request, $wantAll = false): array

/**
* fullAnnulPoPo
*
* Prim Endpoint: RPC.common.Api.Po.fullAnnulPo
*
*
* @param \Gdinko\Prim\Interfaces\PrimRequestInterface $request
* @param boolean $wantAll
* @return array
*
* @throws \Gdinko\Prim\Exceptions\PrimException
* @throws \Gdinko\Prim\Exceptions\PrimValidationException
*/
Prim::fullAnnulPoPo(PrimRequestInterface $request, $wantAll = false): array

/**
* getPos
*
* Prim Endpoint: RPC.common.Api.Pos.get
*
*
* @param \Gdinko\Prim\Interfaces\PrimRequestInterface $request
* @param boolean $wantAll
* @return array
*
* @throws \Gdinko\Prim\Exceptions\PrimException
* @throws \Gdinko\Prim\Exceptions\PrimValidationException
*/
Prim::getPos(PrimRequestInterface $request, $wantAll = false): array

/**
* setPrices
*
* Prim Endpoint: RPC.common.Api.Prices.set
*
*
* @param \Gdinko\Prim\Interfaces\PrimRequestInterface $request
* @param boolean $wantAll
* @return array
*
* @throws \Gdinko\Prim\Exceptions\PrimException
* @throws \Gdinko\Prim\Exceptions\PrimValidationException
*/
Prim::setPrices(PrimRequestInterface $request, $wantAll = false): array

/**
* getPricesLists
*
* Prim Endpoint: RPC.common.Api.PricesLists.get
*
*
* @param \Gdinko\Prim\Interfaces\PrimRequestInterface $request
* @param boolean $wantAll
* @return array
*
* @throws \Gdinko\Prim\Exceptions\PrimException
* @throws \Gdinko\Prim\Exceptions\PrimValidationException
*/
Prim::getPricesLists(PrimRequestInterface $request, $wantAll = false): array

/**
* setServices
*
* Prim Endpoint: RPC.common.Api.Services.set
*
*
* @param \Gdinko\Prim\Interfaces\PrimRequestInterface $request
* @param boolean $wantAll
* @return array
*
* @throws \Gdinko\Prim\Exceptions\PrimException
* @throws \Gdinko\Prim\Exceptions\PrimValidationException
*/
Prim::setServices(PrimRequestInterface $request, $wantAll = false): array

/**
* getSoInvoicePdfSo
*
* Prim Endpoint: RPC.common.Api.So.getSoInvoicePdf
*
*
* @param \Gdinko\Prim\Interfaces\PrimRequestInterface $request
* @param boolean $wantAll
* @return array
*
* @throws \Gdinko\Prim\Exceptions\PrimException
* @throws \Gdinko\Prim\Exceptions\PrimValidationException
*/
Prim::getSoInvoicePdfSo(PrimRequestInterface $request, $wantAll = false): array

/**
* getSoOrderTypes
*
* Prim Endpoint: RPC.common.Api.SoOrderTypes.get
*
*
* @param \Gdinko\Prim\Interfaces\PrimRequestInterface $request
* @param boolean $wantAll
* @return array
*
* @throws \Gdinko\Prim\Exceptions\PrimException
* @throws \Gdinko\Prim\Exceptions\PrimValidationException
*/
Prim::getSoOrderTypes(PrimRequestInterface $request, $wantAll = false): array

/**
* deleteStoreIn
*
* Prim Endpoint: RPC.common.Api.StoreIn.delete
*
*
* @param \Gdinko\Prim\Interfaces\PrimRequestInterface $request
* @param boolean $wantAll
* @return array
*
* @throws \Gdinko\Prim\Exceptions\PrimException
* @throws \Gdinko\Prim\Exceptions\PrimValidationException
*/
Prim::deleteStoreIn(PrimRequestInterface $request, $wantAll = false): array

/**
* deleteStoreOut
*
* Prim Endpoint: RPC.common.Api.StoreOut.delete
*
*
* @param \Gdinko\Prim\Interfaces\PrimRequestInterface $request
* @param boolean $wantAll
* @return array
*
* @throws \Gdinko\Prim\Exceptions\PrimException
* @throws \Gdinko\Prim\Exceptions\PrimValidationException
*/
Prim::deleteStoreOut(PrimRequestInterface $request, $wantAll = false): array

/**
* getStores
*
* Prim Endpoint: RPC.common.Api.Stores.get
*
*
* @param \Gdinko\Prim\Interfaces\PrimRequestInterface $request
* @param boolean $wantAll
* @return array
*
* @throws \Gdinko\Prim\Exceptions\PrimException
* @throws \Gdinko\Prim\Exceptions\PrimValidationException
*/
Prim::getStores(PrimRequestInterface $request, $wantAll = false): array

/**
* getTaxDeals
*
* Prim Endpoint: RPC.common.Api.TaxDeals.get
*
*
* @param \Gdinko\Prim\Interfaces\PrimRequestInterface $request
* @param boolean $wantAll
* @return array
*
* @throws \Gdinko\Prim\Exceptions\PrimException
* @throws \Gdinko\Prim\Exceptions\PrimValidationException
*/
Prim::getTaxDeals(PrimRequestInterface $request, $wantAll = false): array

/**
* getTaxInstances
*
* Prim Endpoint: RPC.common.Api.TaxInstances.get
*
*
* @param \Gdinko\Prim\Interfaces\PrimRequestInterface $request
* @param boolean $wantAll
* @return array
*
* @throws \Gdinko\Prim\Exceptions\PrimException
* @throws \Gdinko\Prim\Exceptions\PrimValidationException
*/
Prim::getTaxInstances(PrimRequestInterface $request, $wantAll = false): array

/**
* getVendorTypes
*
* Prim Endpoint: RPC.common.Api.VendorTypes.get
*
*
* @param \Gdinko\Prim\Interfaces\PrimRequestInterface $request
* @param boolean $wantAll
* @return array
*
* @throws \Gdinko\Prim\Exceptions\PrimException
* @throws \Gdinko\Prim\Exceptions\PrimValidationException
*/
Prim::getVendorTypes(PrimRequestInterface $request, $wantAll = false): array
```

### Commands

[](#commands)

```
#get prim api status (use -h to view options)
#need to run migrations for this command to store data
php artisan prim:api-status
```

### Models

[](#models)

```
PrimApiStatus
PrimLog
PrimErrorLog
```

### Events

[](#events)

```
PrimHookEvent
```

### Interfaces

[](#interfaces)

If you need to make custom PrimRequest you need to implement this interface

```
PrimRequestInterface
```

### Requests

[](#requests)

Implements PrimRequestInterface

```
PrimRequest
PrimNoValidationRequest //no client site data validation
PrimCustomRequest //used for GET request, with no data wrapping
```

### Request Example

[](#request-example)

```
$pr = new PrimRequest(
    ['code' => 'Code', 'name' => 'Name'],  //request data
    false, //get all | true / false
    Prim::getValidationRules('RPC.common.Api.Accounts', 'get'), // auto generate validation rules | or skip this param | or pass custom validation rules
    true, //by default data will be wrapped in additional [] | true / false
)
```

Listen for Prim Hook Event
--------------------------

[](#listen-for-prim-hook-event)

1. In Prim Dashboard subscribe for Hook and set YOUR API HOOK URL: \[your domain\]/api/prim/hook?api\_token=\[laravel:sanctum:token\]

```
//subscribe to PrimHookEvent in EventServiceProvider->boot method
//https://laravel.com/docs/9.x/events
Event::listen(function (PrimHookEvent $event) {

    //do something cool with prim payload
    dd($event->payload);
});
```

Examples
--------

[](#examples)

### Get All Prim API Methods

[](#get-all-prim-api-methods)

```
use Gdinko\Prim\Facades\Prim;
use Gdinko\Prim\Exceptions\PrimException;
use Gdinko\Prim\Exceptions\PrimValidationException;

try {
    $methods = Prim::getAllMethods();
    dd($methods);
} catch (PrimException | PrimValidationException $pe) {
    echo class_basename($pe) . '';
    echo $pe->getCode() . '';
    echo $pe->getMessage() . '';
    dd($pe->getErrors());
} catch (\Exception $e) {
    echo class_basename($e) . '';
    echo $e->getCode() . '';
    echo $e->getMessage() . '';
}
```

### Get All Accounts

[](#get-all-accounts)

\**This example usage is valid for all methods*

```
use Gdinko\Prim\Facades\Prim;
use Gdinko\Prim\Exceptions\PrimException;
use Gdinko\Prim\Exceptions\PrimValidationException;
use Gdinko\Prim\Requests\PrimRequest;

try {
    $accounts = Prim::getAccounts(
        new PrimRequest(
            [], //empty params
            true, //get all flag
        )
    );

    dd($accounts);
} catch (PrimException | PrimValidationException $pe) {
    echo class_basename($pe) . '';
    echo $pe->getCode() . '';
    echo $pe->getMessage() . '';
    dd($pe->getErrors());
} catch (\Exception $e) {
    echo class_basename($e) . '';
    echo $e->getCode() . '';
    echo $e->getMessage() . '';
}
```

### Get All Accounts with no client site validation request and get all prim response, not only result fields

[](#get-all-accounts-with-no-client-site-validation-request-and-get-all-prim-response-not-only-result-fields)

\**This example usage is valid for all methods*

```
use Gdinko\Prim\Facades\Prim;
use Gdinko\Prim\Exceptions\PrimException;
use Gdinko\Prim\Exceptions\PrimValidationException;
use Gdinko\Prim\Requests\PrimNoValidationRequest;

try {
    $accounts = Prim::getAccounts(
        new PrimNoValidationRequest(
            [], //empty params, no client site validation only prim validation
            true, //get all flag
        ),
        true
    );

    dd($accounts);
} catch (PrimException $pe) {
    echo class_basename($pe) . '';
    echo $pe->getCode() . '';
    echo $pe->getMessage() . '';
    dd($pe->getErrors());
} catch (\Exception $e) {
    echo class_basename($e) . '';
    echo $e->getCode() . '';
    echo $e->getMessage() . '';
}
```

### Search for Accounts with autogenerated request validation rules

[](#search-for-accounts-with-autogenerated-request-validation-rules)

\**This example usage is valid for all methods*

```
use Gdinko\Prim\Facades\Prim;
use Gdinko\Prim\Exceptions\PrimException;
use Gdinko\Prim\Exceptions\PrimValidationException;
use Gdinko\Prim\Requests\PrimRequest;

try {
    $accounts = Prim::getAccounts(
        new PrimRequest(
            ['code' => 'CoDe', 'name' => 'NaMe'], //request params
            false, //dot not return all
            Prim::getValidationRules('RPC.common.Api.Accounts', 'get') //auto generate validation rules
        )
    );

    dd($accounts);
} catch (PrimException | PrimValidationException $pe) {
    echo class_basename($pe) . '';
    echo $pe->getCode() . '';
    echo $pe->getMessage() . '';
    dd($pe->getErrors());
} catch (\Exception $e) {
    echo class_basename($e) . '';
    echo $e->getCode() . '';
    echo $e->getMessage() . '';
}
```

### Testing

[](#testing)

```
composer test
```

### Changelog

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

### Security

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Dinko Georgiev](https://github.com/gdinko)
- [silabg.com](https://www.silabg.com/) ❤️
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

51

—

FairBetter than 96% of packages

Maintenance82

Actively maintained with recent releases

Popularity26

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity72

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~94 days

Total

14

Last Release

91d ago

PHP version history (3 changes)v1.0.1PHP ^7.4|^8.0

v1.0.7PHP ^7.4|^8.0|^8.1|^8.2|^8.3

v1.0.11PHP ^7.4|^8.0|^8.1|^8.2|^8.3|^8.4|^8.5

### Community

Maintainers

![](https://www.gravatar.com/avatar/f408c26073a07cc3190b341d6c9deee83d57841262fa5be6fa2cc0512deb5575?d=identicon)[gdinko](/maintainers/gdinko)

---

Top Contributors

[![gdinko](https://avatars.githubusercontent.com/u/2735905?v=4)](https://github.com/gdinko "gdinko (20 commits)")

---

Tags

laravelprimgdinkoprim laravel

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/gdinko-prim/health.svg)

```
[![Health](https://phpackages.com/badges/gdinko-prim/health.svg)](https://phpackages.com/packages/gdinko-prim)
```

###  Alternatives

[irazasyed/telegram-bot-sdk

The Unofficial Telegram Bot API PHP SDK

3.3k4.5M84](/packages/irazasyed-telegram-bot-sdk)[dcblogdev/laravel-microsoft-graph

A Laravel Microsoft Graph API (Office365) package

168285.5k1](/packages/dcblogdev-laravel-microsoft-graph)[vluzrmos/slack-api

Wrapper for Slack.com WEB API.

102589.1k3](/packages/vluzrmos-slack-api)[smodav/mpesa

M-Pesa API implementation

16363.7k1](/packages/smodav-mpesa)[dcblogdev/laravel-xero

A Laravel Xero package

53129.1k1](/packages/dcblogdev-laravel-xero)[simplestats-io/laravel-client

Client for SimpleStats!

4515.5k](/packages/simplestats-io-laravel-client)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
