Skip to content

joanfont/contexts

Repository files navigation

Contexts

Build Status codecov

a PHP library that emulates Python's with statement

Example

<?php
use function Contexts\with;
use Contexts\Context;

class TestContext implements Context
{
  public function enter()
  {
    print("Before executing function\n");
  }

  public function quit($exception)
  {
    print("After executing function\n");
  }
}

$context = new TestContext;
with($context, function() {
  print("Executing function\n");
});

?>

Testing

phpunit tests

Credits

About

a PHP library that emulates Python's `with` statement

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages