PHPackages                             dantofema/mogotes-laravel - 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. dantofema/mogotes-laravel

ActiveLibrary

dantofema/mogotes-laravel
=========================

This is my package mogotes-laravel

v1.0.0(5mo ago)038[2 PRs](https://github.com/dantofema/mogotes-laravel/pulls)MITPHPPHP ^8.4CI passing

Since Jan 13Pushed 2mo agoCompare

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

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

Mogotes Laravel
===============

[](#mogotes-laravel)

[![Latest Version on Packagist](https://camo.githubusercontent.com/cd957cdcbe7a0147d3df185b0a2c377b0d22aebb479c28a16aa55281eaf63050/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f64616e746f66656d612f6d6f676f7465732d6c61726176656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/dantofema/mogotes-laravel)[![Total Downloads](https://camo.githubusercontent.com/402b6bc98c87c296ffc502ed7e627349debd03dc6efa164f2f1658d01961001d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f64616e746f66656d612f6d6f676f7465732d6c61726176656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/dantofema/mogotes-laravel)[![License](https://camo.githubusercontent.com/5ac0b44986edcab8e4761ac8ea281ea97fcf82d6dbd64df4c9953cca8f2dbf0b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f64616e746f66656d612f6d6f676f7465732d6c61726176656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/dantofema/mogotes-laravel)

Cliente Laravel para interactuar con los servicios de [Mogotes](https://mogotes.com) - Feature Flags, Notificaciones y Logs.

Instalación
-----------

[](#instalación)

```
composer require dantofema/mogotes-laravel
```

Publica el archivo de configuración:

```
php artisan vendor:publish --tag="mogotes-laravel-config"
```

Configura las variables de entorno en tu `.env`:

```
MOGOTES_API_KEY=tu_api_key_aqui
MOGOTES_SERVER_URL=https://api.mogotes.com
MOGOTES_WEBHOOK_SECRET=tu_webhook_secret
```

Uso
---

[](#uso)

### 📧 Notificaciones

[](#-notificaciones)

Envía notificaciones por email o WhatsApp usando plantillas configuradas en Mogotes.

```
use Dantofema\MogotesLaravel\Facades\Mogotes;

// Email
Mogotes::email(
    template: 'welcome-email',
    to: 'user@example.com',
    data: ['name' => 'Juan', 'code' => '12345']
);

// WhatsApp
Mogotes::whatsapp(
    template: 'order-confirmation',
    to: '+5491112345678',
    data: ['order_id' => '12345', 'total' => '$100']
);

// Notificación genérica (cualquier canal)
Mogotes::notifications()->send(
    channel: 'email',
    template: 'custom-template',
    to: 'recipient@example.com',
    data: ['key' => 'value'],
    idempotencyKey: 'unique-key-123' // Opcional
);
```

### 📊 Logs

[](#-logs)

Envía logs estructurados a Mogotes para centralizar el monitoreo de tu aplicación.

```
use Dantofema\MogotesLaravel\Facades\Mogotes;

// Log de información
Mogotes::log()->info('Usuario creado', [
    'user_id' => 123,
    'email' => 'user@example.com'
]);

// Log de error
Mogotes::log()->error('Falló el pago', [
    'payment_id' => 456,
    'error' => 'Tarjeta rechazada'
]);

// Otros niveles disponibles
Mogotes::log()->warning('Advertencia', ['context' => 'value']);
Mogotes::log()->debug('Debug info', ['data' => [...]]);

// Listar logs con filtros
$logs = Mogotes::log()->list([
    'level' => 'error',
    'from_date' => '2024-01-01',
    'to_date' => '2024-01-31',
    'per_page' => 50
]);
```

### 🚩 Feature Flags

[](#-feature-flags)

Controla funcionalidades de tu aplicación de forma dinámica sin redesplegar código.

```
use Dantofema\MogotesLaravel\Facades\Mogotes;

// Verificar si un flag está activo
if (Mogotes::feature()->IsActive('nueva-funcionalidad')) {
    // Código para la nueva funcionalidad
}

// Con scope (por usuario, tenant, etc.)
if (Mogotes::feature()->IsActive('beta-feature', scopeId: 'user-123')) {
    // Funcionalidad beta para usuario específico
}
```

**Integración con Laravel Pennant:**

El paquete también registra automáticamente un driver de Pennant para usar Feature Flags nativamente:

```
use Laravel\Pennant\Feature;

// Verificar flag
if (Feature::active('nueva-funcionalidad')) {
    // ...
}

// Con scope
Feature::for($user)->active('beta-feature');
```

### 🔐 Webhooks

[](#-webhooks)

Recibe eventos de Mogotes en tu aplicación de forma segura.

#### Configuración automática

[](#configuración-automática)

El paquete registra automáticamente la ruta `/mogotes/webhook` (configurable en `.env`):

```
MOGOTES_WEBHOOK_PATH=/mogotes/webhook
MOGOTES_WEBHOOK_REGISTER_ROUTE=true
```

#### Validación de firma

[](#validación-de-firma)

```
use Dantofema\MogotesLaravel\Services\WebhookSignatureValidator;

$validator = new WebhookSignatureValidator(
    secret: config('mogotes-laravel.webhooks.secret')
);

try {
    $validator->validate(
        rawBody: $request->getContent(),
        signature: $request->header('Mogotes-Signature'),
        timestamp: (int) $request->header('Mogotes-Timestamp')
    );

    // Webhook válido, procesar evento
    $event = $request->json();

} catch (InvalidWebhookSignatureException $e) {
    // Firma inválida o timestamp expirado
    return response()->json(['error' => 'Invalid signature'], 401);
}
```

#### Escuchar eventos

[](#escuchar-eventos)

Crea listeners para los eventos de Mogotes:

```
use Dantofema\MogotesLaravel\Events\WebhookReceived;

Event::listen(WebhookReceived::class, function (WebhookReceived $event) {
    $payload = $event->payload;

    // Procesar evento según tipo
    match ($payload['event_type'] ?? null) {
        'notification.sent' => // Notificación enviada
        'notification.failed' => // Notificación fallida
        default => // Otro evento
    };
});
```

Configuración avanzada
----------------------

[](#configuración-avanzada)

```
// config/mogotes-laravel.php

return [
    'base_url' => env('MOGOTES_SERVER_URL', 'https://api.mogotes.com'),
    'api_key' => env('MOGOTES_API_KEY'),
    'timeout_seconds' => env('MOGOTES_TIMEOUT_SECONDS', 5),

    'feature_flags' => [
        'ttl_seconds' => env('MOGOTES_FEATURE_FLAGS_TTL_SECONDS', 300),
        'cache_enabled' => env('MOGOTES_FEATURE_FLAGS_CACHE_ENABLED', true),
    ],

    'webhooks' => [
        'register_route' => env('MOGOTES_WEBHOOK_REGISTER_ROUTE', true),
        'path' => env('MOGOTES_WEBHOOK_PATH', '/mogotes/webhook'),
        'secret' => env('MOGOTES_WEBHOOK_SECRET'),
    ],
];
```

Excepciones
-----------

[](#excepciones)

El paquete lanza excepciones específicas para facilitar el manejo de errores:

- `MogotesUnauthorizedException` - API key inválida o expirada
- `MogotesApiException` - Error genérico de la API
- `MogotesConnectionException` - No se pudo conectar al servidor
- `MogotesRateLimitException` - Límite de requests excedido
- `MogotesIdempotencyConflictException` - Conflicto de idempotencia
- `InvalidWebhookSignatureException` - Firma de webhook inválida

Testing
-------

[](#testing)

```
composer test
```

License
-------

[](#license)

The MIT License (MIT). Ver [License File](LICENSE.md) para más información.

###  Health Score

40

—

FairBetter than 86% of packages

Maintenance79

Regular maintenance activity

Popularity7

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 91.3% 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

Unknown

Total

1

Last Release

171d ago

### Community

Maintainers

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

---

Top Contributors

[![dantofema](https://avatars.githubusercontent.com/u/3074220?v=4)](https://github.com/dantofema "dantofema (21 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (1 commits)")

---

Tags

laraveldantofemamogotes-laravel

###  Code Quality

TestsPest

Static AnalysisPHPStan, Rector

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/dantofema-mogotes-laravel/health.svg)

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

###  Alternatives

[spatie/laravel-permission

Permission handling for Laravel 12 and up

12.9k102.4M1.4k](/packages/spatie-laravel-permission)[spatie/laravel-pdf

Create PDFs in Laravel apps

1.0k4.8M47](/packages/spatie-laravel-pdf)[dedoc/scramble

Automatic generation of API documentation for Laravel applications.

2.1k11.2M100](/packages/dedoc-scramble)[defstudio/telegraph

A laravel facade to interact with Telegram Bots

816333.6k3](/packages/defstudio-telegraph)[spatie/laravel-passkeys

Use passkeys in your Laravel app

471890.7k39](/packages/spatie-laravel-passkeys)[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3914.6k](/packages/rawilk-profile-filament-plugin)

PHPackages © 2026

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