PHPackages                             manuwhat/shortcut - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. manuwhat/shortcut

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

manuwhat/shortcut
=================

Shortcut - class instantiation Shortcut designer

v1.0.1(7y ago)18MITPHP

Since Apr 6Pushed 7y ago1 watchersCompare

[ Source](https://github.com/manuwhat/shortcut)[ Packagist](https://packagist.org/packages/manuwhat/shortcut)[ Docs](https://github.com/manuwhat/Shortcut)[ RSS](/packages/manuwhat-shortcut/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (2)Dependencies (1)Versions (4)Used By (0)

Class Instantiation Shortcut for PHP
====================================

[](#class-instantiation-shortcut-for-php)

[![Build Status](https://camo.githubusercontent.com/fed728ee8cfcf0b2068e346a554e5c24dd64c0178661d29da15b63b7db45967c/68747470733a2f2f7472617669732d63692e6f72672f6d616e75776861742f73686f72746375742e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/manuwhat/shortcut)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/3aa55660c854f3074480257499a6e4e40af9b729f9857aac3fa4db55b9663152/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6d616e75776861742f73686f72746375742f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/manuwhat/shortcut/?branch=master)[![Build Status](https://camo.githubusercontent.com/ac03e93fcfd3a2201a55b0d39ab33fab3ce9af64b905f2a2461c9deec7806c57/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6d616e75776861742f73686f72746375742f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/manuwhat/shortcut/build-status/master)[![Code Intelligence Status](https://camo.githubusercontent.com/7b90a1001f08c8c22cc84d1a37d173a45b133aeebf902cee921ca34f385fbec7/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6d616e75776861742f73686f72746375742f6261646765732f636f64652d696e74656c6c6967656e63652e7376673f623d6d6173746572)](https://scrutinizer-ci.com/code-intelligence)

Library which create custom Shortcut for classes Instantiation.

**Requires**: PHP 5.3+

### Why Create Shortcut for PHP classes Instantiation?

[](#why-create-shortcut-for-php-classes-instantiation)

Typically you would create Shortcut for class instantiation if:

1. You need something more customized just like PHP create arrays with the array() function .
2. You want to be more productive avoiding the "new" keyword usage but also too long class name repetitive usage .
3. Instead of a gain of productivity You just are nostalgic of the times when you were using Python or the old fashion style of javaScript when you were not load yourself of the "new" keyword to instantiate a new object.
4. Just for the fun to do it.
5. Because you are just crazy in love with functions -:).

### How to use it

[](#how-to-use-it)

Require the library by issuing this command:

```
composer require manuwhat/Shortcut
```

Add `require 'vendor/autoload.php';` to the top of your script.

Next, create a Shortcut, just like this:

```
use ezama/Shortcut;

create_Shortcut('fullQualifiedclassname'[,'chosen_Shortcut_name']);
create_Shortcut('ArrayIterator');
```

The `Shortcut` is once and forever until cache suppression automatically created and the code included then you can use it in your script:

```
$obj=chosen_Shortcut_name(); // ==> ### if no chosen name has been specified then you may use!
$obj=fullQualifiedclassname();// of course you must pass the arguments if the constructor require them at instantiation
$iterator=ArrayIterator([1,1,2,3,3]);
```

By default shortcuts are cached in a default directory but you can specify a custom directory path where shortcuts will be saved using

```
use ezama/Shortcut;
Shortcut::setDir('your/path/here');
create_Shortcut('fullQualifiedclassname'[,'chosen_Shortcut_name']);
create_Shortcut('ArrayIterator','AI');
```

Keep in mind that only one custom Shortcut can be defined per class and that only instantiable classes can be used.

To run unit tests

```
phpunit  ./tests
```

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 96.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

2595d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/06f6de07cb99fb97189e3607288a40110ad055335e15fd5633c98751b78b6211?d=identicon)[manuwhat](/maintainers/manuwhat)

---

Top Contributors

[![manuwhat](https://avatars.githubusercontent.com/u/29569475?v=4)](https://github.com/manuwhat "manuwhat (57 commits)")[![scrutinizer-auto-fixer](https://avatars.githubusercontent.com/u/6253494?v=4)](https://github.com/scrutinizer-auto-fixer "scrutinizer-auto-fixer (2 commits)")

---

Tags

constructorclassobjectfunctionproductivityshortcutpooinstance

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/manuwhat-shortcut/health.svg)

```
[![Health](https://phpackages.com/badges/manuwhat-shortcut/health.svg)](https://phpackages.com/packages/manuwhat-shortcut)
```

###  Alternatives

[doctrine/instantiator

A small, lightweight utility to instantiate objects in PHP without invoking their constructors

11.0k853.3M335](/packages/doctrine-instantiator)[myclabs/deep-copy

Create deep copies (clones) of your objects

8.9k849.8M169](/packages/myclabs-deep-copy)[symfony/property-access

Provides functions to read and write from/to an object or array using a simple string notation

2.8k295.3M2.5k](/packages/symfony-property-access)[nette/robot-loader

🍀 Nette RobotLoader: high performance and comfortable autoloader that will search and autoload classes within your application.

89152.7M321](/packages/nette-robot-loader)[cuyz/valinor

Dependency free PHP library that helps to map any input into a strongly-typed structure.

1.5k9.2M108](/packages/cuyz-valinor)[yzen.dev/plain-to-class

Class-transformer to transform your dataset into a structured object

16293.9k6](/packages/yzendev-plain-to-class)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
