Download the PHP package ncac/phpcs-standard without Composer

On this page you can find all versions of the php package ncac/phpcs-standard. 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 phpcs-standard

NCAC PHPCS Standard

Build Status Latest Stable Version Total Downloads PHP Version codecov License

An opinionated PHP coding standard focused on type safety and consistency

NCAC is a comprehensive PHP_CodeSniffer standard that enforces strict typing, consistent naming conventions, and 2-space indentation. Built on top of proven standards like Slevomat, it adds custom rules designed for modern PHP development practices.

🎯 Key Features

Strict Type Safety

Enforces explicit type declarations for all parameters, return values, and properties to catch errors early and improve code clarity.

2-Space Indentation with Smart Array Handling

Uses 2-space indentation with context-aware formatting for arrays and function arguments.

Consistent Naming Conventions

Enforces context-appropriate naming: snake_case for variables and functions, camelCase for class properties and methods, PascalCase for classes.

🏗️ What Makes NCAC Different?

This is an opinionated standard that makes specific choices about code formatting and structure. While these choices work well for many teams, they may not suit every project or preference.

Built on Proven Foundations

Note: For PHP 7.4 support, use version ^1.2.0. See BREAKING_CHANGES.md for migration details.

Opinionated Choices

When to Consider NCAC

Good fit for:

⚠️ Consider carefully for:

📊 Quality Assurance

Continuous Integration (PHP 8.0 - 8.2)

Psalm Analysis PHPCS Analysis PHPUnit Tests

⚡ Quick Start

Requirements

Installation

Basic Usage

Quick Start: One-Line Command

The easiest way to apply the full NCAC formatting workflow:

This automatically runs the complete 3-step formatting workflow for you (PHP-CS-Fixer → PHPCBF → PHPCS validation).

💡 Pro Tip: Add a script to your project's composer.json for easy access:

Then run: composer format or composer format:dry

Manual: Full Workflow (Advanced)

If you prefer running each step manually:

Why this workflow? PHP-CS-Fixer handles ~95% of complex formatting (alternate syntax, spacing), while PHPCBF handles NCAC-specific rules. This combination achieves the best conformity to the standard.

Alternative: PHPCS/PHPCBF Only

If you prefer to use only PHPCS tools (without PHP-CS-Fixer):

Note: Using PHPCBF alone may leave some violations unfixed (~60% auto-fix rate vs ~95% with the full workflow). See docs/WORKFLOW_STRATEGY.md for details.

Project Configuration

Create a phpcs.xml in your project root:

📚 Documentation

🎨 Code Examples

Before (Inconsistent formatting)

After (NCAC compliant)

🔧 Advanced Configuration

Custom Rulesets

Disable specific rules for legacy codebases:

Customize Slevomat spacing rules (built-in configurability):

Drupal Compatibility

Enable support for Drupal hook naming conventions:

Why this is needed: Drupal uses double underscores (__) in hook function names to target specific template suggestions. For example:

Without these options enabled, PHPCBF would incorrectly transform:

Configuration options:

Note: NCAC custom sniffs (like NCAC.Formatting.ClassClosingSpacing, NCAC.WhiteSpace.TwoSpacesIndent) are not yet configurable. This is planned for future releases.

🛠️ Development & Contributing

Development Setup

VS Code Dev Container (Recommended)

  1. Clone the repository:

  2. Generate environment (before opening in VS Code):

  3. Open in VS Code: The Dev Container will automatically configure everything.

Manual Setup

🔧 Tool Strategy: PHPCS vs PHP-CS-Fixer

NCAC uses a strategic separation between detection and correction to avoid conflicts and ensure reliable results:

Current Implementation (v1.0)

Why Some Rules Are Detection-Only

Certain rules like NoAlternateControlStructureSniff intentionally provide no automatic fixes due to PHP_CodeSniffer's token processing limitations:

Example issue:

Planned Evolution (v4.x)

📖 Learn more: See docs/PHPCS_VS_PHPCSFIXER_STRATEGY.md for technical details.

Contributing

We welcome contributions! Please see our Contributing Guidelines for:

🏆 Acknowledgments

NCAC is built upon two excellent foundational projects:

NCAC adds 7 custom sniffs for specific formatting and naming requirements:

License Compliance: NCAC operates under the MIT license and respects all incorporated project licenses. See LICENSE for details.

🚀 Requirements & Compatibility

✨ Features At a Glance

📞 Support & Community

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.


Get started:


All versions of phpcs-standard with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
friendsofphp/php-cs-fixer Version ^3.64
slevomat/coding-standard Version ^8.22
squizlabs/php_codesniffer Version ^4
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 ncac/phpcs-standard contains the following files

Loading the files please wait ...