PHPackages                             emeraldinspirations/lib-createconstructcallable - 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. emeraldinspirations/lib-createconstructcallable

ActiveLibrary

emeraldinspirations/lib-createconstructcallable
===============================================

Returns an anonymous callable function referencing the constructor of a class

1.0.0(8y ago)013MITPHP

Since Sep 3Pushed 8y agoCompare

[ Source](https://github.com/emeraldinspirations/lib-createconstructcallable)[ Packagist](https://packagist.org/packages/emeraldinspirations/lib-createconstructcallable)[ RSS](/packages/emeraldinspirations-lib-createconstructcallable/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

[![emeraldinspirations logo](https://camo.githubusercontent.com/c67fa1beb89c73a2ce2b2b21d7138d7fdb8c6e7352dbfa052f052835f6bcf013/687474703a2f2f76707335363133322e7670732e6f76682e63612f6c6f676f2e6769744875622e706e67)](https://camo.githubusercontent.com/c67fa1beb89c73a2ce2b2b21d7138d7fdb8c6e7352dbfa052f052835f6bcf013/687474703a2f2f76707335363133322e7670732e6f76682e63612f6c6f676f2e6769744875622e706e67)

lib-createconstructcallable
===========================

[](#lib-createconstructcallable)

> A component of [emeraldinspiration](https://github.com/emeraldinspirations)'s [library](https://github.com/emeraldinspirations/library).

Returns an anonymous callable function referencing the constructor of a class

PHP does not yet have a syntax for creating a callable for the constructor of a class. Some workarounds involve using ReflectionClass. (See: )

This class provides an alternate option. It creates an anonymous function that fulfills the callable need and runs the relevant constructor.

Installing / Getting started
----------------------------

[](#installing--getting-started)

This project has no dependencies, so can simply be required with [composer](https://getcomposer.org/)

```
composer require emeraldinspirations/lib-createconstructcallable
```

How to use
----------

[](#how-to-use)

```
