PHPackages                             cammanderson/phruts - 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. [Framework](/categories/framework)
4. /
5. cammanderson/phruts

ActiveLibrary[Framework](/categories/framework)

cammanderson/phruts
===================

PHP Implementation of Struts

v0.9-alpha(11y ago)2531[3 issues](https://github.com/cammanderson/phruts/issues)LGPL-3.0PHPPHP &gt;=5.3.7

Since Sep 5Pushed 11y ago1 watchersCompare

[ Source](https://github.com/cammanderson/phruts)[ Packagist](https://packagist.org/packages/cammanderson/phruts)[ RSS](/packages/cammanderson-phruts/feed)WikiDiscussions master Synced today

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

phruts
======

[](#phruts)

PHP implementation of Struts in current framework interoperability group standards.

[![Travis build status master](https://camo.githubusercontent.com/592f1d8c87abf6afcfca2ecf1deee8e2cea2e0442de73f1f58818f957837eb59/68747470733a2f2f7472617669732d63692e6f72672f63616d6d616e646572736f6e2f7068727574732e7376673f6272616e63683d6d6173746572)](https://camo.githubusercontent.com/592f1d8c87abf6afcfca2ecf1deee8e2cea2e0442de73f1f58818f957837eb59/68747470733a2f2f7472617669732d63692e6f72672f63616d6d616e646572736f6e2f7068727574732e7376673f6272616e63683d6d6173746572)[![Coverage Status](https://camo.githubusercontent.com/86fcb8b236f8c5ce235058f718247d715472c53c42add773415cafef77d61937/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f63616d6d616e646572736f6e2f7068727574732f62616467652e706e673f6272616e63683d6d6173746572)](https://coveralls.io/r/cammanderson/phruts?branch=master)[![SensioLabsInsight](https://camo.githubusercontent.com/8994c1fe4bc0a0ab562a34b63dfbfb0a529765ac3ec0dd0b3e5610e1f17d893b/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f30393130656633322d666364342d343138642d396438382d6239643535393838313738302f6d696e692e706e67)](https://insight.sensiolabs.com/projects/0910ef32-fcd4-418d-9d88-b9d559881780)

- Run through Silex (e.g. get Dependency Injection, dispatcher, security, cache, esi, etc and support building up of other services)
- Uses Symfony HTTPFoundation/HTTPKernel
- Implements PSR's (Naming Conventions, Logging, Autoloading)
- Use Twig or your other preference dependencies

What is Phruts?
---------------

[](#what-is-phruts)

Phruts is based on Apache Struts, a Java MVC framework. Your controllers are configured through an XML file, which then also controls application flow and forwarding. Some parts are OK, some parts are much better done by other frameworks.

Install
-------

[](#install)

Add to your composer and do a `composer update`

```
"require": {
    "cammanderson/phruts": "~0.9"
}

```

Add to your Silex application
-----------------------------

[](#add-to-your-silex-application)

```
// web/index.php
require_once __DIR__.'/../vendor/autoload.php';

// Use standard HttpFoundation
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\HttpKernelInterface;

// Create a silex application
$app = new Silex\Application();

// Add in Twig as the template handler
$app->register(new Silex\Provider\TwigServiceProvider(), array('twig.path' => __DIR__.'/../app/Resources/views'))
    ->register(new Silex\Provider\MonologServiceProvider(), array('monolog.logfile' => __DIR__.'/../app/logs/development.log'));

// Add in phruts to organise your controllers
$app->register(new Phruts\Provider\PhrutsServiceProvider(), array(
        // Register our modules and configs
        Phruts\Util\Globals::ACTION_KERNEL_CONFIG => array(
            'config' => '../app/config/web-config.xml', // Supports multiple modules/configurations
        )
    ));

// Add template handling for matching forwards to Twig templates
$app->get('{path}', function($path) use ($app) {
        return $app['twig']->render($path);
    })
    ->assert('path', '.+\.twig');

// Add routes to be matched by Phruts
$app->get('{path}', function (Request $request) use ($app) {
        return $app[\Phruts\Util\Globals::ACTION_KERNEL]->handle($request, HttpKernelInterface::SUB_REQUEST, false);
    })
    ->assert('path', '.*')
    ->value('path', '/'); // Set the welcome path

$app->run();

```

Configure your MVC config
-------------------------

[](#configure-your-mvc-config)

Create your app/config/web-config.xml. This configuration is digested using the [Phigester](https://github.com/cammanderson/phigester) which will read in the XML configuration and reflect them onto the application configuration. Configuration is then frozen and cached.

```

```

Extra things:

- Create your `app/cache` folder (this is a config option)
- Create a twig template `app/Resources/views/welcome.html.twig`

Feature support:

- Error handlers
- Global forwards
- Request Processor based on roles defined by Symfony Security
- Action forwards (internal action chaining)
- Wildcard path matching
- Action switching and multiple module support
- Multiple module config merging (e.g. multi config.xml)
- Struts 1.2 API

Current Development Status
--------------------------

[](#current-development-status)

- COMPLETE: Code Coverage 35%+
- COMPLETE: Code Coverage 75%+
- COMPLETE: Finalise ActionKernel for mounting on Silex\\Application
- UNDERWAY: Confirm Struts 1.2 code coverage for framework features
- UNDERWAY: Write the standard Struts style Twig extensions for accessing form+messages
- Next: Documentation on working with Silex
- Consider Struts Validation framework (we never used it, so might not make it forward)
- Struts 1.3 framework features (for convenience techniques only)

Why would I do this? Best way to learn techniques in web development is through studying Request-&gt;Response web frameworks. I have a soft-spot for the old Struts application, and we have legacy PHPMVC code which we would like to easily move forward. This project makes it easy for us to port that legacy code and modernise it fast by implementing PSR's, giving that code base a future supported life.

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

4246d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7b7e2790fff48e485c35c4cf333514955fc432645c8493ded8a7863b5a521116?d=identicon)[cammanderson](/maintainers/cammanderson)

---

Top Contributors

[![cammanderson](https://avatars.githubusercontent.com/u/578846?v=4)](https://github.com/cammanderson "cammanderson (3 commits)")

---

Tags

phpstruts

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/cammanderson-phruts/health.svg)

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

###  Alternatives

[laravel/framework

The Laravel Framework.

34.6k509.9M17.0k](/packages/laravel-framework)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[drupal/core

Drupal is an open source content management platform powering millions of websites and applications.

19462.3M1.3k](/packages/drupal-core)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[elgg/elgg

Elgg is an award-winning social networking engine, delivering the building blocks that enable businesses, schools, universities and associations to create their own fully-featured social networks and applications.

1.7k15.7k4](/packages/elgg-elgg)[contao/core-bundle

Contao Open Source CMS

1231.6M2.3k](/packages/contao-core-bundle)

PHPackages © 2026

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