PHPackages                             php-defer/php-defer - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. php-defer/php-defer

ActiveLibrary

php-defer/php-defer
===================

Golang's defer statement for PHP

v5.0.7(2y ago)307378.2k—4.7%172MITPHPPHP ^7.4 || ^8.0

Since Oct 8Pushed 2y ago8 watchersCompare

[ Source](https://github.com/php-defer/php-defer)[ Packagist](https://packagist.org/packages/php-defer/php-defer)[ RSS](/packages/php-defer-php-defer/feed)WikiDiscussions 5.0 Synced 1mo ago

READMEChangelog (10)Dependencies (1)Versions (31)Used By (2)

PHP Defer
=========

[](#php-defer)

[![Coverage Status](https://camo.githubusercontent.com/a4c61b50eaaab231eb56c40b7735c2c9b2aebe06f4ed8a4a50e5f2d1af3acff4/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f7068702d64656665722f7068702d64656665722f62616467652e7376673f6272616e63683d352e30)](https://coveralls.io/github/php-defer/php-defer?branch=5.0)[![Tests status](https://github.com/php-defer/php-defer/actions/workflows/tests.yml/badge.svg?branch=5.0)](https://github.com/php-defer/php-defer/actions/workflows/tests.yml?query=branch%3A5.0)

The [defer statement](https://blog.golang.org/defer-panic-and-recover) originally comes from Golang. This library allows you to use the defer functionality in your PHP code.

Usage
-----

[](#usage)

```
