PHPackages                             shieldci/analyzers-core - 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. [Security](/categories/security)
4. /
5. shieldci/analyzers-core

ActiveLibrary[Security](/categories/security)

shieldci/analyzers-core
=======================

Shared foundation for building static analysis tools - includes abstract analyzer classes, result formatters, file parsers, and utilities

v1.0.2(1mo ago)04.9k↑80.6%1MITPHPPHP ^8.1CI passing

Since Nov 7Pushed 1mo agoCompare

[ Source](https://github.com/ShieldCI/analyzers-core)[ Packagist](https://packagist.org/packages/shieldci/analyzers-core)[ RSS](/packages/shieldci-analyzers-core/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (10)Versions (21)Used By (1)

ShieldCI Analyzers Core
=======================

[](#shieldci-analyzers-core)

Shared foundation for building static analysis tools. Includes abstract analyzer classes, result formatters, file parsers, and utilities.

[![Tests](https://github.com/shieldci/analyzers-core/actions/workflows/tests.yml/badge.svg)](https://github.com/shieldci/analyzers-core/actions/workflows/tests.yml)[![codecov](https://camo.githubusercontent.com/5dbe1417ed1551f99ee167a07631a4c3a0b2ffbd1f1c2befa34bd68180802973/68747470733a2f2f636f6465636f762e696f2f67682f736869656c6463692f616e616c797a6572732d636f72652f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/shieldci/analyzers-core)[![PHP Version](https://camo.githubusercontent.com/83dd395020c37276225039739320f6c8e7e99963ab21ee3d09282cb48dad2a60/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e312532422d626c7565)](https://www.php.net/)[![License](https://camo.githubusercontent.com/f8df3091bbe1149f398a5369b2c39e896766f9f6efba3477c63e9b4aa940ef14/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e)](LICENSE)[![PHPStan](https://camo.githubusercontent.com/942bdbddc7b2adea1d63ed80793492d06d72ef41911edcba33310d0745581548/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d4c6576656c253230392d627269676874677265656e)](https://phpstan.org/)

Features
--------

[](#features)

- **Framework Agnostic**: Works with any PHP 8.1+ project
- **Type Safe**: Full type hints and strict typing
- **Extensible**: Easy to create custom analyzers
- **Well Tested**: Comprehensive test suite (100% coverage)
- **Modern PHP**: Uses PHP 8.1+ features
- **Laravel Compatible**: Works with Laravel 9.x, 10.x, 11.x, 12.x and 13.x

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

[](#requirements)

- PHP 8.1 or higher
- Composer

Installation
------------

[](#installation)

```
composer require shieldci/analyzers-core
```

Architecture
------------

[](#architecture)

### Core Components

[](#core-components)

1. **Interfaces**

    - `AnalyzerInterface` - Contract for all analyzers
    - `ResultInterface` - Contract for analysis results
    - `ReporterInterface` - Contract for result formatters
    - `ParserInterface` - Contract for code parsers
2. **Abstract Base Classes**

    - `AbstractAnalyzer` - Base class with timing, error handling, and helper methods
    - `AbstractFileAnalyzer` - Base class for file-based analyzers with file filtering
3. **Value Objects**

    - `Location` - Represents a code location (file, line, column)
    - `Issue` - Represents a specific issue found
    - `CodeSnippet` - Represents a code snippet with context lines
    - `AnalyzerMetadata` - Metadata about an analyzer
4. **Results**

    - `AnalysisResult` - Result of running a single analyzer
    - `ResultCollection` - Collection of analysis results
5. **Utilities**

    - `AstParser` - AST parsing using nikic/php-parser
    - `FileParser` - File content parsing utilities
    - `CodeHelper` - Code analysis helpers
    - `ConfigFileHelper` - Laravel configuration file utilities
    - `MessageHelper` - Error message sanitization (redacts credentials, tokens, IPs)
    - `InlineSuppressionParser` - Parses `@shieldci-ignore` inline suppression comments
6. **Formatters**

    - `JsonFormatter` - Format results as JSON
    - `ConsoleFormatter` - Format results for console output

Usage
-----

[](#usage)

### Creating a Custom Analyzer

[](#creating-a-custom-analyzer)

```
