PHPackages                             contoweb/laravel-abacus-api - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. contoweb/laravel-abacus-api

ActiveLibrary[HTTP &amp; Networking](/categories/http)

contoweb/laravel-abacus-api
===========================

Laravel wrapper for Abacus REST API to consume it in a Laravel way.

v0.1.0(1mo ago)60MITPHPPHP ^8.2|^8.3|^8.4CI passing

Since Jun 23Pushed 1mo agoCompare

[ Source](https://github.com/contoweb/laravel-abacus-api)[ Packagist](https://packagist.org/packages/contoweb/laravel-abacus-api)[ RSS](/packages/contoweb-laravel-abacus-api/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (1)Dependencies (8)Versions (2)Used By (0)

Abacus REST API Package for Laravel
===================================

[](#abacus-rest-api-package-for-laravel)

 [![Banner](https://camo.githubusercontent.com/7ecf765c54e9211f82d30b52a4540fdfa7fbb8df79166bd12e9ad25ff7bf5d94/68747470733a2f2f636f6e746f7765622e63682f6173736574732f62636266386230322d656436382d346132612d393265352d3139373336366263643637332e706e67)](https://camo.githubusercontent.com/7ecf765c54e9211f82d30b52a4540fdfa7fbb8df79166bd12e9ad25ff7bf5d94/68747470733a2f2f636f6e746f7765622e63682f6173736574732f62636266386230322d656436382d346132612d393265352d3139373336366263643637332e706e67)

[![Tests](https://github.com/contoweb/laravel-abacus-api/actions/workflows/tests.yml/badge.svg)](https://github.com/contoweb/laravel-abacus-api/actions/workflows/tests.yml)[![Code Style](https://github.com/contoweb/laravel-abacus-api/actions/workflows/code-style.yml/badge.svg)](https://github.com/contoweb/laravel-abacus-api/actions/workflows/code-style.yml)[![Latest Stable Version](https://camo.githubusercontent.com/93a3cefadf9e03c543b5cfe474ddb7283762f10ee262da560a4014e563cf2a83/68747470733a2f2f706f7365722e707567782e6f72672f636f6e746f7765622f6c61726176656c2d6162616375732d6170692f762f737461626c65)](https://packagist.org/packages/contoweb/laravel-abacus-api)[![License](https://camo.githubusercontent.com/d12c1233c93f356b170e4ab5b773af6856afbe7b9133f5ee821d959bff0008e2/68747470733a2f2f706f7365722e707567782e6f72672f636f6e746f7765622f6c61726176656c2d6162616375732d6170692f6c6963656e7365)](https://packagist.org/packages/contoweb/laravel-abacus-api)

Laravel package for the Abacus REST API with OData support, Eloquent-like models, and AbaReports integration.

Table of Contents
-----------------

[](#table-of-contents)

- [Requirements](#requirements)
- [Installation](#installation)
- [Configuration](#configuration)
- [OData Entity API](#odata)
    - [Create Your Own Model](#create-your-own-model)
    - [Use the Models](#use-the-models)
    - [CRUD Operations](#crud-operations)
    - [Retrieving Files](#retrieving-files)
    - [Bound OData Actions](#bound-odata-actions)
    - [Pagination](#pagination)
    - [Batch Requests](#batch-requests)
    - [Working Directly with the Service](#working-directly-with-the-service)
- [OData Action API](#odata-action-api)
    - [Price Finding](#price-finding)
- [AbaReports](#abareports)
    - [Creating Reports](#creating-reports)
    - [Using Reports](#using-reports)
    - [Parameter Validation](#parameter-validation)
    - [Mapping Reports](#mapping-reports)
- [IDE Support](#ide-support)
- [Troubleshooting](#troubleshooting)
- [Links](#links)

Requirements
------------

[](#requirements)

- **Laravel** 12.x or 13.x
- **PHP** 8.2, 8.3, or 8.4

Features
--------

[](#features)

- **Eloquent-like API** - Familiar Laravel syntax
- **OData Support** - Filter, Select, OrderBy, Top, Expand
- **AbaReports** - Fetch AbaReport data
- **Type-Safe** - Full PHPDoc support
- **IDE Autocomplete** - Automatic IDE Helper generation
- **CRUD Operations** - Create, Read, Update, Delete
- **Batch Requests** - Multiple operations in a single HTTP request
- **Query Builder** - Fluent interface for complex queries
- **Testable** - Easy mocking with Laravel HTTP Fake

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

[](#installation)

```
composer require contoweb/laravel-abacus-api
```

Publish the config file:

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

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

[](#configuration)

### Environment Variables

[](#environment-variables)

Add to your `.env` file:

```
ABACUS_REST_API_URL=entity-api1-1.demo.abacus.ch
ABACUS_REST_API_MANDATE=7777
ABACUS_REST_API_CLIENT_ID=your-client-id
ABACUS_REST_API_CLIENT_SECRET=your-client-secret
```

OData
-----

[](#odata)

### Create your own Model

[](#create-your-own-model)

You can easily create custom models for any Abacus endpoint.

```
php artisan make:abacus-model Subject --resource=Subjects
```

This creates:

```
