Skip to content

12 articles

#PHP (page 2)

Every article tagged PHP, newest first. Search all articles

  • Single gears each spinning on their own small test stand with a green light, on a watchmaker's bench beside tweezers and a loupe.Development

    7 min read

    WordPress plugin unit testing with wp-env and PHPUnit

    WordPress plugin unit testing stays repeatable when pure PHP tests stay small and WordPress integration tests run in a wp-env environment. Set up wp-env, bootstrap the WordPress PHPUnit files through WP_TESTS_DIR, write tests with WP_UnitTestCase, then run the same command in GitHub Actions.

    • WordPress
    • Plugins
    • PHP
    Read article
  • A brass key console feeds one punched card into a big machine that sorts thousands of small glowing pieces into bins in batches.Development

    6 min read

    How to write a custom WP-CLI command for your plugin

    A WP CLI custom command belongs in your plugin when a maintenance or data task needs a repeatable command-line interface. Register a command class only when WP-CLI is running, describe its arguments in PHPDoc, then add dry-run handling, bounded batches, machine-readable output and exit codes.

    • WP-CLI
    • WordPress
    • Plugins
    Read article
  • A relay of messengers runs glowing parcels from a distant castle to a doorstep and stopwatch, while miners dig a shortcut tunnel below.Performance

    7 min read

    How to reduce WordPress TTFB: a diagnostic guide

    To reduce WordPress TTFB, measure the same request at each layer instead of tuning WordPress blindly. Separate DNS, connection and TLS time from time to first byte, compare CDN hits with origin requests, then profile PHP, database work and external calls on the slow path.

    • WordPress
    • TTFB
    • Performance
    Read article