Contribution Guide

April 27, 2026 ยท View on GitHub

Contributions are welcome and are accepted via pull requests. Please review these guidelines before submitting any pull requests.

Process

  1. Fork the project.
  2. Create a new branch.
  3. Code, test, commit, and push.
  4. Open a pull request detailing your changes. Make sure to follow the template.

Guidelines

  • Please ensure the coding style by running composer lint.
  • Send a coherent commit history, making sure each individual commit in your pull request is meaningful.
  • You may need to rebase to avoid merge conflicts.
  • Please remember that we follow SemVer.

Installation and Setup

git clone https://github.com/laravel/agent-detector.git agent-detector
cd agent-detector
composer install

Lint

Lint your code:

composer lint

Tests

Run all tests:

composer test

Check types:

composer test:types

Unit tests:

composer test:unit

Adding a New Agent

To add detection for a new agent:

  1. Add a new case to the KnownAgent enum in src/KnownAgent.php.
  2. Add the detection logic (env var check or file check) in AgentDetector::detect() in src/AgentDetector.php โ€” order matters, earlier checks take priority.
  3. Add tests in tests/AgentDetectorTest.php.