PHPackages                             mmorand/laravel-apertus - 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. mmorand/laravel-apertus

ActiveLibrary[API Development](/categories/api)

mmorand/laravel-apertus
=======================

Laravel package for the Swiss made Apertus LLM

0.2.0(1mo ago)3238MITPHPPHP ^8.3

Since Sep 22Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/mmorand/laravel-apertus)[ Packagist](https://packagist.org/packages/mmorand/laravel-apertus)[ Docs](https://github.com/mmorand/laravel-apertus)[ RSS](/packages/mmorand-laravel-apertus/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (28)Versions (5)Used By (0)

[![Apertus Logo](./assets/images/header.png)](./assets/images/header.png)

Laravel Client for Apertus LLM
==============================

[](#laravel-client-for-apertus-llm)

[![Latest Version on Packagist](https://camo.githubusercontent.com/d8d96244ebdc0e28a142da5c6f352afe1e1486c2f0636d155d7402ad9ba1927d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d6d6f72616e642f6c61726176656c2d617065727475732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mmorand/laravel-apertus)[![Total Downloads](https://camo.githubusercontent.com/ea27fb3178fa896a8496a606684b6a79deb7116ea3a50dcfbcc742750a494255/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d6d6f72616e642f6c61726176656c2d617065727475732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mmorand/laravel-apertus)

The Apertus AI PHP Client enables seamless integration with the Apertus AI API, providing straightforward access to Swiss AI models for chat completions and model management.

More informations about Apertus AI can be found on their [website](https://www.swiss-ai.org/apertus) and [API Reference](https://platform.publicai.co/api).

Features
--------

[](#features)

- ✅ **Chat Completions** - Full conversation support with streaming
- ✅ **Model Management** - List available models
- ✅ **Laravel Integration** - Native Laravel support with Facades
- ✅ **Type Safety** - Fully typed DTOs using Spatie Laravel Data
- ✅ **Modern PHP** - Built with PHP 8.3+ and Saloon HTTP client

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

[](#installation)

You can install the package via Composer:

```
composer require mmorand/laravel-apertus
```

You can publish the config file with:

```
php artisan vendor:publish --tag="apertus-config"
```

This is the contents of the published config file:

```
return [
    'api_key' => env('APERTUS_API_KEY'),
    'base_url' => env('APERTUS_BASE_URL', 'https://api.publicai.co'),
    'user_agent' => env('APERTUS_USER_AGENT', 'Apertus-Laravel-Client/1.0.0'),
    'timeout' => env('APERTUS_TIMEOUT', 60),
];
```

Add your Apertus API key to your `.env` file:

```
APERTUS_API_KEY=your_api_key_here
APERTUS_BASE_URL=https://api.publicai.co
APERTUS_USER_AGENT=MyApp/1.0
APERTUS_TIMEOUT=30
```

Get your API key from the [Apertus AI Console](https://platform.publicai.co/settings/api-keys).

Usage
-----

[](#usage)

### Basic Setup

[](#basic-setup)

Create an instance of the Apertus client to start interacting with the API:

```
use Mmorand\Apertus\Apertus;
use Mmorand\Apertus\Enums\Model;

// Instantiate the client
$apertus = new Apertus(
    apiKey: config('apertus.api_key'),
    baseUrl: 'https://api.publicai.co',
    userAgent: 'MyApp/1.0'
);

// Or use the Facade (Laravel)
use Mmorand\Apertus\Facades\Apertus;

Apertus::chat();
Apertus::models();
```

### Chat Completions

[](#chat-completions)

Create a chat completion:

```
use Mmorand\Apertus\Facades\Apertus;
use Mmorand\Apertus\Enums\Model;

$response = Apertus::chat()->create(
    model: Model::apertus8b,
    messages: [
        [
            'role' => 'user',
            'content' => 'Hello! Can you help me understand Swiss AI?',
        ]
    ],
    temperature: 0.7,
    maxTokens: 1000
);

/** @var \Mmorand\Apertus\Dto\Chat\ChatCompletionResponse $dto */
$dto = $response->dto();
```

### Model Management

[](#model-management)

List available models:

```
$response = Apertus::models()->list();

/** @var \Mmorand\Apertus\Dto\Models\ModelsResponse $dto */
$dto = $response->dto();
```

### Artisan Commands

[](#artisan-commands)

List available models using Artisan:

```
php artisan apertus:models
```

### Available Models

[](#available-models)

The following models are available in the Apertus API. You can use the `Model` enum in this package to refer to them.

Enum CaseModel NameDocumentation Link`Model::apertus8b``'swiss-ai/apertus-8b-instruct'`[Apertus 8b Docs](https://huggingface.co/swiss-ai/Apertus-8B-Instruct-2509)`Model::apertus70b``'swiss-ai/apertus-70b-instruct'`[Apertus 70b Docs](https://huggingface.co/swiss-ai/Apertus-70B-Instruct-2509)```
use Mmorand\Apertus\Enums\Model;

Model::apertus8b  // swiss-ai/apertus-8b-instruct - Small Apertus model
Model::apertus70b // swiss-ai/apertus-70b-instruct - Complete Apertus model
```

Testing
-------

[](#testing)

Run the tests with:

```
composer test
```

Static Analysis
---------------

[](#static-analysis)

Analyze code with PHPStan:

```
composer analyse
```

Code Style
----------

[](#code-style)

Fix code style with Laravel Pint:

```
composer format
```

Inspired by the excellent work of [HelgeSverre](https://github.com/HelgeSverre) with his [Mistral package](https://github.com/HelgeSverre/mistral).

License
-------

[](#license)

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

Disclaimer
----------

[](#disclaimer)

Apertus AI and the Apertus logo are trademarks of their respective owners. This package is not affiliated with, endorsed by, or sponsored by Apertus AI. All trademarks and registered trademarks are the property of their respective owners.

See the [Terms and Conditions](https://publicai.co/tc) for more information.

###  Health Score

41

—

FairBetter than 87% of packages

Maintenance89

Actively maintained with recent releases

Popularity14

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 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 ~116 days

Total

3

Last Release

54d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/8851737?v=4)[Mathieu Morand](/maintainers/mmorand)[@mmorand](https://github.com/mmorand)

---

Top Contributors

[![mmorand](https://avatars.githubusercontent.com/u/8851737?v=4)](https://github.com/mmorand "mmorand (15 commits)")

---

Tags

phpapilaravelaichatllmapertus

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/mmorand-laravel-apertus/health.svg)

```
[![Health](https://phpackages.com/badges/mmorand-laravel-apertus/health.svg)](https://phpackages.com/packages/mmorand-laravel-apertus)
```

###  Alternatives

[mozex/anthropic-laravel

Laravel integration for the Anthropic API: facade, config publishing, install command, testing fakes, messages, streaming, tool use, thinking, and batches.

74331.3k1](/packages/mozex-anthropic-laravel)[deepseek-php/deepseek-php-client

deepseek PHP client is a robust and community-driven PHP client library for seamless integration with the Deepseek API, offering efficient access to advanced AI and data processing capabilities.

46688.8k5](/packages/deepseek-php-deepseek-php-client)[helgesverre/mistral

Laravel Client for the Mistral.ai API

5519.3k1](/packages/helgesverre-mistral)[mozex/anthropic-php

PHP client for the Anthropic API: messages, streaming, tool use, thinking, web search, code execution, batches, and more.

49552.5k18](/packages/mozex-anthropic-php)[codebar-ag/laravel-docuware

DocuWare integration with Laravel

1123.7k](/packages/codebar-ag-laravel-docuware)[njoguamos/laravel-plausible

A laravel package for interacting with plausible analytics api.

209.6k](/packages/njoguamos-laravel-plausible)

PHPackages © 2026

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