PHPackages                             knplabs/rad-prototype - 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. knplabs/rad-prototype

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

knplabs/rad-prototype
=====================

Pierre PLAZANET &lt;pierre@knplabs.com&gt;

v2.1.0(8y ago)24.2k1[1 PRs](https://github.com/KnpLabs/rad-prototype/pulls)MITPHPPHP ~7.0

Since May 29Pushed 3y ago23 watchersCompare

[ Source](https://github.com/KnpLabs/rad-prototype)[ Packagist](https://packagist.org/packages/knplabs/rad-prototype)[ RSS](/packages/knplabs-rad-prototype/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (6)Versions (10)Used By (0)

DEPRECATED
==========

[](#deprecated)

Unfortunately we decided to not maintain this project anymore ([see why](https://knplabs.com/en/blog/news-for-our-foss-projects-maintenance)). If you want to mark another package as a replacement for this one please send an email to .

Rapid Application Development : Prototype
=========================================

[](#rapid-application-development--prototype)

Automatically inject methods into objects

[![Build Status](https://camo.githubusercontent.com/1ba50480f02629478a8f9d5d1206017680116144eb9a3034300e2af1ef18745e/68747470733a2f2f7472617669732d63692e6f72672f4b6e704c6162732f7261642d70726f746f747970652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/KnpLabs/rad-prototype)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/d9af43e0176e8cc8712eb3dde9618a376ce825062b03cc7f686745006be0de2b/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f4b6e704c6162732f7261642d70726f746f747970652f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/KnpLabs/rad-prototype/?branch=master)[![Latest Stable Version](https://camo.githubusercontent.com/517c5b3396fcfb2dcf472c28545701f8fa40a7d5e57c898c255896f8152ac849/68747470733a2f2f706f7365722e707567782e6f72672f6b6e706c6162732f7261642d70726f746f747970652f762f737461626c65)](https://packagist.org/packages/knplabs/rad-prototype) [![Total Downloads](https://camo.githubusercontent.com/0bd97fa8f84e58222de85d10a382caf300e599d4a19091961cca5a32cd50c06b/68747470733a2f2f706f7365722e707567782e6f72672f6b6e706c6162732f7261642d70726f746f747970652f646f776e6c6f616473)](https://packagist.org/packages/knplabs/rad-prototype) [![Latest Unstable Version](https://camo.githubusercontent.com/3ec1c3e2ac5d59479caa3de30da7d58c085e024035848a7ae532a38b83c2ea60/68747470733a2f2f706f7365722e707567782e6f72672f6b6e706c6162732f7261642d70726f746f747970652f762f756e737461626c65)](https://packagist.org/packages/knplabs/rad-prototype) [![License](https://camo.githubusercontent.com/12a79742784e3018e1842e985c5a6c4fd3d4ef4186f99d3847665de8c149cc26/68747470733a2f2f706f7365722e707567782e6f72672f6b6e706c6162732f7261642d70726f746f747970652f6c6963656e7365)](https://packagist.org/packages/knplabs/rad-prototype)

Installation
============

[](#installation)

```
composer require knplabs/rad-prototype ~2.0
```

```
class AppKernel
{
    function registerBundles()
    {
        $bundles = array(
            //...
            new Knp\Rad\Prototype\Bundle\PrototypeBundle(),
            //...
        );

        //...

        return $bundles;
    }
}
```

Usages
======

[](#usages)

1. Method side
--------------

[](#1-method-side)

You can create injectable methods via dependency injections. You can apply the tag `knp_rad_prototype.prototype_method`. For example, if I want to expose the method `getRepository` form the `@doctrine` service, I just have to declare a new method:

```
knp_rad_prototype.prototype.method.doctrine.get_repository:
    class: Knp\Rad\Prototype\Prototype\Method
    arguments:
       - @doctrine
       - getRepository
   tags:
       - { name: knp_rad_prototype.prototype_method, alias: getRepository, domain: doctrine }
```

The first argument should be a service or a classname (for static methods), the second argument should be a method name. In this case, the method will be `@doctrine->getRepository()`.

The `alias` tag option represent the method name inside the prototype, so in this case, I can call the method with `$this->getRepository()`. Finaly, the `domain` tag option represent the domain of this method, a prototype can recieve method of some domains.

2. Prototype side
-----------------

[](#2-prototype-side)

### 2.1. Attach methods to a controller

[](#21-attach-methods-to-a-controller)

Access to methods from a controller

Your controller should implements the `Knp\Rad\Prototype\Prototype`. You can also use the basic implementation via the trait `Knp\Rad\Prototype\Prototype\Controller`

```
namespace AppBundle\Controller;

use Knp\Rad\Prototype\Prototype;

class ProductController implements Prototype
{
    use Prototype\Controller;

    public function testAction($id)
    {
        $product = $this->getRepository('AppBundle:Product')->find($id);

        $this->persist($product);
        $this->flush();

        // ...
    }
}
```

3. Web Debug Toolbar
--------------------

[](#3-web-debug-toolbar)

When your controller implements the `Knp\Rad\Prototype\Prototype` interface, the following icon will appear into the Symfony web debug toobar.

[![](doc/images/wdt.png)](doc/images/wdt.png)

And you can also access to every accessable methods from your prototypes from the Symfony profiler interface

[![](doc/images/profiler.png)](doc/images/profiler.png)

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 55% 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 ~169 days

Recently: every ~202 days

Total

6

Last Release

3161d ago

Major Versions

v1.1.1 → v2.0.02016-03-04

PHP version history (2 changes)v1.0.0PHP &gt;=5.4

v2.1.0PHP ~7.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/202732?v=4)[KNP Labs](/maintainers/KnpLabs)[@KnpLabs](https://github.com/KnpLabs)

---

Top Contributors

[![PedroTroller](https://avatars.githubusercontent.com/u/1766827?v=4)](https://github.com/PedroTroller "PedroTroller (11 commits)")[![Djeg](https://avatars.githubusercontent.com/u/1638230?v=4)](https://github.com/Djeg "Djeg (6 commits)")[![alexpozzi](https://avatars.githubusercontent.com/u/8307861?v=4)](https://github.com/alexpozzi "alexpozzi (1 commits)")[![AntoineLelaisant](https://avatars.githubusercontent.com/u/4592355?v=4)](https://github.com/AntoineLelaisant "AntoineLelaisant (1 commits)")[![polc](https://avatars.githubusercontent.com/u/3513348?v=4)](https://github.com/polc "polc (1 commits)")

### Embed Badge

![Health badge](/badges/knplabs-rad-prototype/health.svg)

```
[![Health](https://phpackages.com/badges/knplabs-rad-prototype/health.svg)](https://phpackages.com/packages/knplabs-rad-prototype)
```

###  Alternatives

[symfony/maker-bundle

Symfony Maker helps you create empty commands, controllers, form classes, tests and more so you can forget about writing boilerplate code.

3.4k111.1M568](/packages/symfony-maker-bundle)[spomky-labs/pwa-bundle

Progressive Web App Manifest Generator Bundle for Symfony.

6144.4k1](/packages/spomky-labs-pwa-bundle)[codefog/contao-haste

haste extension for Contao Open Source CMS

42650.8k139](/packages/codefog-contao-haste)[symfony/ux-cropperjs

Cropper.js integration for Symfony

19280.3k3](/packages/symfony-ux-cropperjs)[netgen/content-browser

Netgen Content Browser is a Symfony bundle that provides an interface which selects items from any kind of backend and returns the IDs of selected items back to the calling code.

14112.1k8](/packages/netgen-content-browser)[pentiminax/ux-datatables

DataTables.net integration for Symfony

605.6k](/packages/pentiminax-ux-datatables)

PHPackages © 2026

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