How do you test your code ?

This page summarizes the projects mentioned and recommended in the original post on reddit.com/r/PHP

Our great sponsors
  • Cloudways - Managed Cloud Hosting Platform
  • Scout APM - Less time debugging, more time building
  • SonarLint - Clean code begins in your IDE with SonarLint
  • http-kernel

    The HttpKernel component provides a structured process for converting a Request into a Response.

    In that regard, someone posted symfony's test suite as an example of good PHPUnit testing. The first file I clicked on demonstrated how worthless (IMO) unit testing can be: https://github.com/symfony/http-kernel/blob/v6.0.8/Tests/CacheClearer/ChainCacheClearerTest.php

  • Laravel

    Laravel is a web application framework with expressive, elegant syntax. We’ve already laid the foundation for your next big idea — freeing you to create without sweating the small things.

  • Cloudways

    Managed Cloud Hosting Platform. Cloudways leverages advanced technology and powerful servers. Cloudways is a one-click managed cloud hosting platform that provides cloud application and server management solutions.

  • Composer

    Dependency Manager for PHP

  • Guzzle

    Guzzle, an extensible PHP HTTP client

  • Amazon Web Service SDK

    Official repository of the AWS SDK for PHP (@awsforphp)

  • Functional-core-imperative-shell

    Functional core imperative shell

    The pattern functional core, imperative shell will help you make bigger chunks of your code-base be unit testable without database or file scaffolding.

  • Pest

    Pest is an elegant PHP Testing Framework with a focus on simplicity

    Once you're comfortable with PHPUnit (Unit Testing and TDD) the next step is BDD (Behaviour-Driven Development). For this Behat is a good starting point. But my favourite was always Codeception because it has PHPUnit included and does everything (unit tests, functional test, integration tests). The only awkward part ro both of these is installing selenium (at least on windows) Pest is also becoming very popular among the Laravel community, but it will work with anything https://pestphp.com/

  • Scout APM

    Less time debugging, more time building. Scout APM allows you to find and fix performance issues with no hassle. Now with error monitoring and external services monitoring, Scout is a developer's best friend when it comes to application development.

  • Symfony Panther

    A browser testing and web crawling library for PHP and Symfony

    For tools, I use PHPUnit, Symfony's PHPUnit helper classes, and Panther (for frontend/headless-browser testing, mostly JS behavior)

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts