@@ -521,6 +521,85 @@ Include custom text content:
521521}
522522```
523523
524+ ## Modifiers
525+
526+ ### PHP Content Filter Modifier
527+
528+ The modifier allows you to selectively include or exclude PHP class elements such as methods, properties, constants, and
529+ annotations based on configurable criteria.
530+
531+ It supports only php files
532+
533+ #### Features
534+
535+ - Filter methods, properties, and constants by name or pattern
536+ - Include or exclude elements based on visibility (public, protected, private)
537+ - Control whether method bodies are kept or replaced with placeholders
538+ - Optionally keep or remove documentation comments
539+ - Optionally keep or remove PHP 8 attributes
540+ - Filter elements using regular expression patterns
541+
542+ #### JSON Configuration
543+
544+ ``` json
545+ {
546+ "documents" : [
547+ {
548+ "description" : " API Documentation" ,
549+ "outputPath" : " docs/api.md" ,
550+ "sources" : [
551+ {
552+ "type" : " file" ,
553+ "description" : " API Source Files" ,
554+ "sourcePaths" : [
555+ " src/Api"
556+ ],
557+ "filePattern" : " *.php" ,
558+ "modifiers" : [
559+ {
560+ "name" : " php-content-filter" ,
561+ "options" : {
562+ "method_visibility" : [
563+ " public"
564+ ],
565+ "exclude_methods" : [
566+ " __construct"
567+ ],
568+ "keep_method_bodies" : false
569+ }
570+ }
571+ ]
572+ }
573+ ]
574+ }
575+ ]
576+ }
577+ ```
578+
579+ #### Configuration Options
580+
581+ It supports the following configuration options:
582+
583+ | Option | Type | Default | Description |
584+ | ------------------------------| ---------| --------------------------------------| ----------------------------------------------------------------------------------------------|
585+ | ` include_methods ` | array | ` [] ` | List of method names to include (empty means include all unless exclude_methods is set) |
586+ | ` exclude_methods ` | array | ` [] ` | List of method names to exclude (empty means exclude none) |
587+ | ` include_properties ` | array | ` [] ` | List of property names to include (empty means include all unless exclude_properties is set) |
588+ | ` exclude_properties ` | array | ` [] ` | List of property names to exclude (empty means exclude none) |
589+ | ` include_constants ` | array | ` [] ` | List of constant names to include (empty means include all unless exclude_constants is set) |
590+ | ` exclude_constants ` | array | ` [] ` | List of constant names to exclude (empty means exclude none) |
591+ | ` method_visibility ` | array | ` ['public', 'protected', 'private'] ` | List of method visibilities to include |
592+ | ` property_visibility ` | array | ` ['public', 'protected', 'private'] ` | List of property visibilities to include |
593+ | ` constant_visibility ` | array | ` ['public', 'protected', 'private'] ` | List of constant visibilities to include |
594+ | ` keep_method_bodies ` | boolean | ` false ` | Whether to keep method bodies (true) or replace with placeholders (false) |
595+ | ` method_body_placeholder ` | string | ` /* ... */ ` | Placeholder for method bodies when keep_method_bodies is false |
596+ | ` keep_doc_comments ` | boolean | ` true ` | Whether to keep doc comments |
597+ | ` keep_attributes ` | boolean | ` true ` | Whether to keep PHP 8 attributes |
598+ | ` include_methods_pattern ` | string | ` null ` | Regular expression pattern for methods to include |
599+ | ` exclude_methods_pattern ` | string | ` null ` | Regular expression pattern for methods to exclude |
600+ | ` include_properties_pattern ` | string | ` null ` | Regular expression pattern for properties to include |
601+ | ` exclude_properties_pattern ` | string | ` null ` | Regular expression pattern for properties to exclude |
602+
524603## Running Context Generator
525604
526605Once your configuration is in place, run:
0 commit comments