PHPSpec Basics

Use PHPSpec to design your code internal communication

Target audience:

Software Developers familiar with PHP development, who want to start their experience with BDD on Spec level.


20% lecture and 80% hands-on coding


0,5 day


Do you want to start doing BDD? Organization that you are working for are not ready for that big step? Start with yourself. Spec BDD is way that you can start on your own and show other teammates profits from that approach. Especially when you can share with them well designed, tested code.

During the workshop, you will learn what are the main goals of using Spec BDD. You will see how PHPSpec and Prophecy mocking library work. Hands-on exercises will show you how to use them to design your code communication. While attending the workshop you will practice some basic examples of PHPSpec usage.  After that, we will move to more complicated examples that will show how to use PHPSpec in their each day work. Workshop for people who want to start their PHPSpec adventure.

Learning outcomes:

  • Design low-level code building blocks communication.
  • Divide code to small elements that communicate with each other
  • Using mocks to isolate unit that is the spec objective


  • Introduction
    • what is BDD
    • levels od BDD with focus on Spec BDD
    • tools in the PHP ecosystem
  • Spec construction
    • spec building blocks
    • matchers
    • mocks
  • Writing spec
    • atomic examples
    • delegation of responsibilities
    • unit isolation
  • Spec BDD supplements:
    • functional tests and Story BDD
    • integration tests


  • Proficiency in programming in PHP language
  • Laptop/notebook with a working development environment:
    • newest PHP version
    • composer
  • Ability to connect  to the Internet

Room setup:

  • Cabaret or boardroom style setup
  • Projector/screen
  • Whiteboard/flipchart
PHPSpec Basics
Scroll to top