PHPackages                             amphibee/marius-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. [API Development](/categories/api)
4. /
5. amphibee/marius-api

ActiveLibrary[API Development](/categories/api)

amphibee/marius-api
===================

Laravel package for Marius API integration

1.1.3(8mo ago)01.5k1[1 issues](https://github.com/AmphiBee/Marius-Api/issues)[3 PRs](https://github.com/AmphiBee/Marius-Api/pulls)MITPHPPHP ^8.2

Since Dec 18Pushed 3mo ago2 watchersCompare

[ Source](https://github.com/AmphiBee/Marius-Api)[ Packagist](https://packagist.org/packages/amphibee/marius-api)[ RSS](/packages/amphibee-marius-api/feed)WikiDiscussions main Synced 2d ago

READMEChangelogDependencies (7)Versions (10)Used By (0)

Marius API Package
==================

[](#marius-api-package)

A Laravel package for easy interaction with the Marius Application API.

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

[](#-table-of-contents)

- [Installation](#-installation)
- [Configuration](#%EF%B8%8F-configuration)
- [Usage](#-usage)
    - [Campus](#campus)
    - [Courses](#courses)
    - [Applications](#applications)
- [Testing](#-testing)
- [Error Handling](#-error-handling)
- [Contributing](#-contributing)
- [License](#-license)

🚀 Installation
--------------

[](#-installation)

### Requirements

[](#requirements)

- PHP 8.1 or higher
- Laravel 9.0 or higher

### Via Composer

[](#via-composer)

```
composer require amphibee/marius-api
```

The package will be automatically discovered by Laravel. The following Facades will be registered:

- `Campus`
- `Formation`
- `Candidature`

⚙️ Configuration
----------------

[](#️-configuration)

1. Publish the configuration file:

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

2. Configure your environment variables in your `.env` file:

```
MARIUS_API_BASE_URL=https://marius.website.com/api
MARIUS_API_KEY=your-api-key
MARIUS_API_TIMEOUT=10
```

📖 Usage
-------

[](#-usage)

First, import the Facades you need:

```
use AmphiBee\MariusApi\Facades\Campus;
use AmphiBee\MariusApi\Facades\Formation;
use AmphiBee\MariusApi\Facades\Candidature;
use AmphiBee\MariusApi\Exceptions\MariusApiException;
```

### Campus

[](#campus)

Retrieve and manage campus information:

```
try {
    // Get all campuses with their courses
    $campuses = Campus::getCampuses();

    foreach ($campuses as $campus) {
        echo $campus->campus; // Campus name
        echo $campus->id_campus; // Campus ID

        // Access campus courses
        foreach ($campus->formations as $formation) {
            echo $formation->nom_formation;
            echo $formation->niveau_sortie;
        }
    }
} catch (MariusApiException $e) {
    // Handle API errors
    Log::error('Marius API Error: ' . $e->getMessage());
}
```

### Courses

[](#courses)

Manage course information by campus:

```
try {
    // Get courses for a specific campus
    $formations = Formation::getFormationsByCampus('1');

    foreach ($formations as $formation) {
        echo $formation->id_formation;
        echo $formation->nom_formation;
        echo $formation->niveau_sortie;
    }
} catch (MariusApiException $e) {
    // Handle API errors
}
```

### Applications

[](#applications)

Submit and manage student applications:

```
use AmphiBee\MariusApi\DTO\CandidatureDTO;

try {
    $application = new CandidatureDTO([
        'civilite' => 'Mr',
        'nom' => 'Doe',
        'prenom' => 'John',
        'email' => 'john@example.com',
        'portable' => '0612345678',
        'id_campus' => '1',
        'id_formation' => '30'
    ]);

    $response = Candidature::submit($application);
    // $response contains the API response with the application ID

} catch (MariusApiException $e) {
    // Handle API errors
}
```

### Example in a Controller

[](#example-in-a-controller)

Here's a complete example of using the Facades in a Laravel controller:

```
namespace App\Http\Controllers;

use AmphiBee\MariusApi\DTO\CandidatureDTO;
use AmphiBee\MariusApi\Exceptions\MariusApiException;
use AmphiBee\MariusApi\Facades\Campus as Campus;
use AmphiBee\MariusApi\Facades\Formation as Formation;
use AmphiBee\MariusApi\Facades\Candidature as Candidature;
use Illuminate\Http\Request;

class ApplicationController extends Controller
{
    public function index()
    {
        try {
            return view('application.form', [
                'campuses' => Campus::getCampuses()
            ]);
        } catch (MariusApiException $e) {
            return back()->withError($e->getMessage());
        }
    }

    public function getFormations(string $campusId)
    {
        try {
            return response()->json([
                'formations' => Formation::getFormationsByCampus($campusId)
            ]);
        } catch (MariusApiException $e) {
            return response()->json(['error' => $e->getMessage()], 422);
        }
    }

    public function submit(Request $request)
    {
        try {
            $application = new CandidatureDTO($request->validated());
            $response = Candidature::submit($application);

            return redirect()
                ->route('application.success')
                ->with('application_id', $response['id_candidature']);

        } catch (MariusApiException $e) {
            return back()
                ->withInput()
                ->withError($e->getMessage());
        }
    }
}
```

🧪 Testing
---------

[](#-testing)

The package includes a comprehensive test suite. When testing your own application, you can mock the Facades:

```
use AmphiBee\MariusApi\Facades\Campus;
use AmphiBee\MariusApi\Facades\Formation;
use AmphiBee\MariusApi\Facades\Candidature;

it('can list all campuses', function () {
    // Arrange
    Campus::shouldReceive('getCampuses')
        ->once()
        ->andReturn([
            // Your mock data here
        ]);

    // Act
    $response = $this->get('/applications/create');

    // Assert
    $response->assertOk();
});

it('can get formations for campus', function () {
    // Arrange
    Formation::shouldReceive('getFormationsByCampus')
        ->with('1')
        ->once()
        ->andReturn([
            // Your mock data here
        ]);

    // Act
    $response = $this->get('/api/campus/1/formations');

    // Assert
    $response->assertOk();
});
```

❌ Error Handling
----------------

[](#-error-handling)

All Facade methods can throw `MariusApiException`. It's recommended to wrap calls in try-catch blocks:

```
use AmphiBee\MariusApi\Exceptions\MariusApiException;

try {
    $campuses = Campus::getCampuses();
} catch (MariusApiException $e) {
    // The error contains the message and HTTP code from the API error
    Log::error('Marius API Error: ' . $e->getMessage());
    // Handle the error appropriately
}
```

📚 Advanced Usage
----------------

[](#-advanced-usage)

### Working with DTOs

[](#working-with-dtos)

The package uses Data Transfer Objects (DTOs) to ensure type safety and validation:

```
use AmphiBee\MariusApi\DTO\CandidatureDTO;

// Create from array
$application = new CandidatureDTO([
    'civilite' => 'Mr',
    'nom' => 'Doe',
    'prenom' => 'John',
    'email' => 'john@example.com',
    'portable' => '0612345678',
    'id_campus' => '1',
    'id_formation' => '30'
]);

// Create from request
$application = new CandidatureDTO($request->validated());

// Submit
$response = Candidature::submit($application);
```

### Logging API Responses

[](#logging-api-responses)

The package includes built-in logging capabilities for debugging purposes. Each service provides a `getRawResponse()` method that returns the raw API response:

```
use AmphiBee\MariusApi\DTO\CandidatureDTO;
use Illuminate\Support\Facades\Log;

try {
    $application = new CandidatureDTO([
        'civilite' => 'Mr',
        'nom' => 'Doe',
        // ... autres données
    ]);

    $response = Candidature::submit($application);

    // Log the raw response
    Log::channel('api')->info('Marius API Response', [
        'response' => Candidature::getRawResponse()
    ]);

} catch (MariusApiException $e) {
    Log::channel('api')->error('Marius API Error', [
        'message' => $e->getMessage(),
        'trace' => $e->getTraceAsString()
    ]);
}
```

To enable API logging, add this to your `config/logging.php`:

```
'channels' => [
    // ... autres canaux

    'api' => [
        'driver' => 'daily',
        'path' => storage_path('logs/api.log'),
        'level' => env('LOG_LEVEL', 'debug'),
        'days' => 14,
    ],
],
```

The logs will be stored in `storage/logs/api.log` with this format:

```
[2024-03-14 10:30:00] local.INFO: Marius API - Données d'entrée {"data":{"civilite":"Mr","nom":"Doe",...}}
[2024-03-14 10:30:01] local.INFO: Marius API - Réponse {"response":{"id_candidature":"123",...}}

```

🧪 Testing
---------

[](#-testing-1)

The package includes a comprehensive test suite using Pest. To run the tests:

```
./vendor/bin/pest
```

❌ Error Handling
----------------

[](#-error-handling-1)

The package uses a custom `MariusApiException` for error handling. All methods can throw this exception in case of API errors.

```
use AmphiBee\MariusApi\Exceptions\MariusApiException;

try {
    $campuses = $campusService->getCampuses();
} catch (MariusApiException $e) {
    // The error contains the message and HTTP code from the API error
    echo $e->getMessage();
}
```

🤝 Contributing
--------------

[](#-contributing)

Contributions are welcome! Feel free to:

1. Fork the project
2. Create your feature branch (`git checkout -b feature/AmazingFeature`)
3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
4. Push to the branch (`git push origin feature/AmazingFeature`)
5. Open a Pull Request

Make sure to update tests as appropriate.

### Development Setup

[](#development-setup)

1. Clone the repository
2. Install dependencies: `composer install`
3. Run tests: `./vendor/bin/pest`

### Coding Standards

[](#coding-standards)

This package follows PSR-12 coding standards. Before submitting a PR, please ensure your code follows these standards by running:

```
composer fix-style
```

📄 License
---------

[](#-license)

This package is licensed under the MIT License. See the [LICENSE](LICENSE.md) file for details.

🏢 About AmphiBee
----------------

[](#-about-amphibee)

Developed and maintained by [AmphiBee](https://amphibee.fr). For more information about our services or other open-source projects, please visit our website.

🔒 Security
----------

[](#-security)

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

⭐ Support
---------

[](#-support)

If you find this package helpful, please consider starring it on GitHub. For professional support or custom development needs, contact us at .

📚 Documentation
---------------

[](#-documentation)

For detailed documentation of the Marius API itself, please refer to the official API documentation provided by your institution.

### Additional Resources

[](#additional-resources)

- [Laravel Documentation](https://laravel.com/docs)
- [Package Development Guide](https://laravel.com/docs/packages)

###  Health Score

43

—

FairBetter than 89% of packages

Maintenance71

Regular maintenance activity

Popularity20

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 54.2% 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 ~79 days

Total

5

Last Release

246d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8435080f3e74b629258f291a62cb72aa9d63ee44d74e588f594dc6378c328fa2?d=identicon)[amphibee](/maintainers/amphibee)

---

Top Contributors

[![ogorzalka](https://avatars.githubusercontent.com/u/149651?v=4)](https://github.com/ogorzalka "ogorzalka (13 commits)")[![chermant](https://avatars.githubusercontent.com/u/92034659?v=4)](https://github.com/chermant "chermant (7 commits)")[![renovate[bot]](https://avatars.githubusercontent.com/in/2740?v=4)](https://github.com/renovate[bot] "renovate[bot] (4 commits)")

###  Code Quality

TestsPest

Static AnalysisRector

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/amphibee-marius-api/health.svg)

```
[![Health](https://phpackages.com/badges/amphibee-marius-api/health.svg)](https://phpackages.com/packages/amphibee-marius-api)
```

###  Alternatives

[craftcms/cms

Craft CMS

3.6k3.6M3.1k](/packages/craftcms-cms)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3741.3M47](/packages/tencentcloud-tencentcloud-sdk-php)[spatie/laravel-export

Create a static site bundle from a Laravel app

674146.0k6](/packages/spatie-laravel-export)[simplestats-io/laravel-client

Server-side analytics for Laravel that follows the full funnel from visit to registration to payment, attributed to the channel that drove it. Revenue, MRR, churn and ad-spend profit (ROAS/CAC) per channel. GDPR compliant, ad-blocker proof.

5021.9k](/packages/simplestats-io-laravel-client)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

273.0k](/packages/eslazarev-wildberries-sdk)[jasara/php-amzn-selling-partner-api

A fluent interface for Amazon's Selling Partner API in PHP

1348.7k1](/packages/jasara-php-amzn-selling-partner-api)

PHPackages © 2026

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