Download the PHP package therealmkadmi/laravel-citadel without Composer

On this page you can find all versions of the php package therealmkadmi/laravel-citadel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-citadel

A Passive Surveillance Package for Laravel to Protect Your Public Facing Endpoints

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

Laravel Citadel is an advanced, real-time firewall package for Laravel designed to protect your public-facing endpoints—especially those handling critical actions such as order placement. Using Redis and Laravel Octane's in-memory caching, Laravel Citadel performs multi-faceted analysis including rate limiting, payload integrity checks, failure tracking, device fingerprint verification, and referrer validation. Its weighted scoring system dynamically flags suspicious activity, enabling you to stop malicious human or automated abuse before it reaches your business logic.

Installation

You can install the package via Composer:

You can publish and run the migrations with:

You can publish the config file with:

This is the contents of the published config file:

Optionally, you can publish the views using:

Usage

Laravel Citadel works as a middleware. Here’s how you can integrate it into your routes:

1. Register the Middleware

Add the Citadel firewall middleware to your app/Http/Kernel.php:

2. Protect Critical Endpoints

Apply the middleware to your sensitive endpoints. For example, to protect the send-order endpoint:

3. Customize Behavior

Adjust settings in config/citadel.php to tailor the firewall to your needs. The configuration parameters include:

How It Works

Laravel Citadel performs a series of checks on each incoming request:

  1. Real-Time Frequency Tracking:

    • Uses Redis sorted sets to record and analyze request timestamps.
    • Removes entries outside a 60-second window and calculates the current request rate.
    • Enforces a minimum interval between requests to prevent burstiness.
  2. Payload Anomaly Detection:

    • Validates that required fields (e.g., name, table, items) are present.
    • Analyzes text fields using regex and entropy calculations to detect gibberish or repetitive content.
    • Checks for extreme values and logical inconsistencies in numeric data (e.g., unrealistic quantities or price mismatches).
  3. Failure Tracking:

    • Tracks failed attempts via a Redis counter with a TTL.
    • Increments the suspect score for each failure, decaying over time if the user ceases suspicious activity.
  4. Device Fingerprint Analysis:

    • Examines the User-Agent header to determine if the request originates from a mobile device.
    • Assigns additional points for desktop browsers or known automation tools.
  5. Referrer Verification:

    • Validates the HTTP referer against an expected domain.
    • Penalizes requests with a missing referer or one that originates from an unauthorized domain.
  6. Weighted Scoring System:
    • Aggregates scores from frequency, payload, failure, device, and referrer analyses.
    • Compares the cumulative score against a configurable threshold.
    • Blocks the request if the threshold is exceeded, logging the event for further analysis.

Testing

You can run the tests via Composer:

Simulate various scenarios:

Contributing

Contributions are welcome! Please open an issue or submit a pull request. For larger changes, consider discussing your ideas first.

Security Vulnerabilities

For information on reporting security vulnerabilities, contact me privately on wahibmkadmi16 [at] gmail [dot] com.

Credits

License

Laravel Citadel is open-sourced software licensed under the MIT License.


All versions of laravel-citadel with dependencies

PHP Build Version
Package Version
Requires php Version ^8.4
spatie/laravel-package-tools Version ^1.16
illuminate/contracts Version ^10.0||^11.0||^12.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package therealmkadmi/laravel-citadel contains the following files

Loading the files please wait ....