PHPackages                             gtcrais/laravel-centinel-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. gtcrais/laravel-centinel-api

ActiveLibrary[API Development](/categories/api)

gtcrais/laravel-centinel-api
============================

Laravel Centinel API

v2.4.0(1y ago)046MITPHP

Since Mar 20Pushed 1y ago1 watchersCompare

[ Source](https://github.com/GTCrais/LaravelCentinelApi)[ Packagist](https://packagist.org/packages/gtcrais/laravel-centinel-api)[ RSS](/packages/gtcrais-laravel-centinel-api/feed)WikiDiscussions master Synced yesterday

READMEChangelog (10)Dependencies (1)Versions (22)Used By (0)

Laravel Centinel API for Laravel 5
==================================

[](#laravel-centinel-api-for-laravel-5)

This package provides API for downloading the application log file, and dumping and downloading the database. It ships with authentication middleware which protects the API routes.

Centinel API is designed to work in combination with [**Centinel**](https://centinel.online) - centralized application management system.

> ##### For **Laravel 4.2** use [Centinel API v1.2](https://github.com/GTCrais/LaravelCentinelApi/tree/v1.2)
>
> [](#for-laravel-42-use-centinel-api-v12)

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

[](#requirements)

- PHP 5.6+
- Laravel 5.1+ (Laravel 5.0 is not supported due to incompatibility with Symfony components used in it)
- make sure your Cache driver is configured and is working
- Windows environment is not supported

Installation: Laravel
---------------------

[](#installation-laravel)

- add `"gtcrais/laravel-centinel-api": "2.3.*"` to your `composer.json` and run `composer update`
- for Laravel `withFacades();` in `/bootstrap/app.php`
- add `$app->configure('centinelApi');` to `/bootstrap/app.php`. This will load Centinel API configuration
- add `$app->register(GTCrais\LaravelCentinelApi\LumenCentinelApiServiceProvider::class);` to `/bootstrap/app.php` **below** config file registration
- run `php artisan centinel-api:setup`

Additional Installation Notes
-----------------------------

[](#additional-installation-notes)

### Laravel 5.1

[](#laravel-51)

- add `routePrefix` to `VerifyCsrfToken` middleware's `$except` array. Example:

```
protected $except = [
	'Hts71OwsRTwjXDb5Kdp5zk5l6KsvEz7Q/*' // Note the /* at the end
];
```

### Lumen

[](#lumen)

Centinel API will first look for database connection configuration in `/config/database.php`. If it's not available there, it will look in `.env` file. Make sure one of these options is available if you wish to use the database dump functionality.

Usage
-----

[](#usage)

**It's highly recommended to use this plugin only on websites that use HTTPS!**

After going through the installation process you will find `centinelApi.php` configuration file in `/config` directory. From there, copy `privateKey`, `encryptionKey` and `routePrefix` to [**Centinel**](https://centinel.online), and you're ready to schedule your application log checks and database backups.

### Config File

[](#config-file)

- `privateKey` - random string, used for authentication
- `encryptionKey` - random string, used for additional security layer
- `routePrefix` - random string, prefixing the API routes
- `enabledRoutes` - if you only wish to expose a part of the API, you can disable either Log or Database routes here
- `disableTimeBasedAuthorization` - set to `true` in case of your server's and Centinel's datetime being out of sync which results in `Request time mismatch` or `Too many API calls` error
- `zipPassword` - password used when zipping the database dump. **Make sure to save the Zip Password so you can restore your database in case of server crash**
- `database` - database settings and options

All of the database options except for `connection` are optional.

Some of the database options are not available for Laravel/Lumen 5.1, and on PHP 5 (regardless of the framework version). For more details check [Spatie DB Dumper v1.5.1](https://github.com/spatie/db-dumper/tree/1.5.1)

For details on how to use the options check the installed version of the package. For Laravel/Lumen 5.2+ on PHP 7 that will be [Spatie DB Dumper v2.9](https://github.com/spatie/db-dumper/tree/2.9.0)

To ignore a database setting/option, set it to `null`.

### API Routes

[](#api-routes)

- \[POST\] `/{routePrefix}/create-log`
- \[POST\] `/{routePrefix}/download-log`
- \[POST\] `/{routePrefix}/dump-database`
- \[POST\] `/{routePrefix}/download-database`

For more details check `/Controllers/CentinelApiController.php` controller.

### Database Backups

[](#database-backups)

[Spatie DB Dumper](https://github.com/spatie/db-dumper) is used to make database dumps. **MySQL** and **PostgreSQL**are supported, and require `mysqldump` and `pg_dump` utilities, respectively.

Additionally, on Laravel/Lumen **5.2+** applications running on **PHP 7**, **Sqlite** and **MongoDB** are supported, and require `sqlite3` and `mongodump` utilities, respectively.

Centinel API will try to zip and password protect database dumps before sending them to Centinel. In case you're using PHP 7.2+, it will use PHP's native `ZipArchive` class to zip and encrypt the database. Otherwise, it will look for 7-Zip and Zip libraries to do so. If no option is available, dumps will be sent without being zipped and password protected.

Run `php artisan centinel-api:check-zip` to see which library is available on your server. Note that Zip encryption algorithm is much less secure than that of ZipArchive and 7-Zip. Ultimately it is up to you to decide which level of security is satisfactory. You can always opt out of backing up your database by disabling database backups in Centinel, and additionally, commenting out `DatabaseRoutes` in the `enabledRoutes` config option.

### Authentication

[](#authentication)

For details check `/Middleware/AuthorizeCentinelApiRequest.php` middleware.

License
-------

[](#license)

Laravel Centinel API is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT).

###  Health Score

35

—

LowBetter than 79% of packages

Maintenance40

Moderate activity, may be stable

Popularity8

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

Recently: every ~611 days

Total

21

Last Release

502d ago

Major Versions

v1.1.x-dev → v2.0.x-dev2018-03-25

v1.2.0 → v2.1.x-dev2018-03-30

v1.2.x-dev → v2.2.02018-04-13

### Community

Maintainers

![](https://www.gravatar.com/avatar/18f7a834bca30b4b00efcf42852d375cf1a9941c47398b84e764f785adc8aaf7?d=identicon)[GTCrais](/maintainers/GTCrais)

---

Top Contributors

[![GTCrais](https://avatars.githubusercontent.com/u/3007615?v=4)](https://github.com/GTCrais "GTCrais (12 commits)")

---

Tags

Laravel Centinel API

### Embed Badge

![Health badge](/badges/gtcrais-laravel-centinel-api/health.svg)

```
[![Health](https://phpackages.com/badges/gtcrais-laravel-centinel-api/health.svg)](https://phpackages.com/packages/gtcrais-laravel-centinel-api)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M454](/packages/google-gax)

PHPackages © 2026

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