yousha/codecop

A lightweight static analyzer that scan PHP files for quality issues.

Installs: 43

Dependents: 1

Suggesters: 0

Security: 0

pkg:composer/yousha/codecop

2.0.0 2025-12-23 13:56 UTC

This package is auto-updated.

Last update: 2025-12-23 13:57:35 UTC


README

A lightweight static analyzer that scan PHP files for quality issues.

current version PHP PHP contributions welcome

Contents

Overview

CodeCop is a lightweight yet powerful static analysis tool designed specifically for PHP codebases. This command-line utility scans PHP files within a specified directory (and its subdirectories) to identify common code quality issues that can affect maintainability, reliability, and consistency of PHP applications. The tool focuses on enforcing modern PHP best practices and detecting potential problems before they make their way into production environments.

Features

  • No external dependency/library
  • Validates strict type(declare(strict_types=1)) declaration
  • Enforces final or abstract for all classes
  • Requires return types for all methods (except __construct)
  • Skips non-project directories automatically
  • Handles anonymous classes properly
  • Detects non-UTF-8 encoded files
  • Warns about UTF-8 BOM (Byte Order Mark)
  • Supported PHP: 7.4 to 8.5
  • Supported platforms: Windows, GNU/Linux, MacOS

Requirements

  1. PHP >= 7.4 to PHP == 8.5
  2. Composer >= 2

Installation

Via Composer:

composer require yousha/codecop --dev

Usage

php vendor/bin/codecop .

Or:

php vendor/bin/codecop src/

Check version:

php vendor/bin/codecop --version

Get help:

php vendor/bin/codecop --help

Support

Changelog

See CHANGELOG.txt file.

ToDo

See TODO.txt file.

Notice

See NOTICE.txt file.

License

This open-source software is distributed under the GPL-3.0 license. See LICENSE file.