PHPackages                             mamuz/phalcon-application - 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. mamuz/phalcon-application

ActiveLibrary[Framework](/categories/framework)

mamuz/phalcon-application
=========================

Phalcon Application provides simple and customizable application bootstrapping

v2.4.0(7y ago)117.7k21MITPHPPHP ^7.0

Since Aug 16Pushed 7y ago4 watchersCompare

[ Source](https://github.com/mamuz/phalcon-application)[ Packagist](https://packagist.org/packages/mamuz/phalcon-application)[ Docs](https://github.com/mamuz/phalcon-application)[ RSS](/packages/mamuz-phalcon-application/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (1)Versions (23)Used By (1)

phalcon-application
===================

[](#phalcon-application)

[![Author](https://camo.githubusercontent.com/e49859db77ebe675300539af2d01c10b7568b92df2dbbd190335170cd198e5fa/687474703a2f2f696d672e736869656c64732e696f2f62616467652f617574686f722d406d616d757a5f64652d626c75652e7376673f7374796c653d666c61742d737175617265)](https://twitter.com/mamuz_de)[![Build Status](https://camo.githubusercontent.com/22211d64d12ddb0812f57661983c09d240f7a787459ad0fb982235c21d6cff52/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6d616d757a2f7068616c636f6e2d6170706c69636174696f6e2e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/mamuz/phalcon-application)[![Latest Stable Version](https://camo.githubusercontent.com/c9976e6dd18392d739f84a2fd1e01c85b52297e015860962bbfa94326cd82487/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d616d757a2f7068616c636f6e2d6170706c69636174696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mamuz/phalcon-application)[![Total Downloads](https://camo.githubusercontent.com/5e525c7af3f0d4828f37ea050daa839fd8b64d6ea777fe0c7aae80eb5612a895/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d616d757a2f7068616c636f6e2d6170706c69636174696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mamuz/phalcon-application)[![License](https://camo.githubusercontent.com/b0c5050094b8c96674e49484404315e83adc2a97446867c9176afa3d49a32f6e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6d616d757a2f7068616c636f6e2d6170706c69636174696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mamuz/phalcon-application)

Phalcon Application is built on top of Phalcon3 Framework and provides simple and customizable application bootstrapping.

Requirements
------------

[](#requirements)

- Phalcon3 is needed, follow install steps at

Installation
------------

[](#installation)

Install the latest version with

```
$ composer require mamuz/phalcon-application
```

Features
--------

[](#features)

- Autoloading with Composer
- Simple mvc configuration
- Service registration
- XHR friendly view renderer

Usage
-----

[](#usage)

### Bootstrapping an application without view support, e.g. a REST application

[](#bootstrapping-an-application-without-view-support-eg-a-rest-application)

```
$config = [
    'dispatcher' => [
        // define class namespace identifier of your controllers
        'controllerDefaultNamespace' => 'Rest\Controller',
    ],
    'routes' => [
        // see Router::add in https://docs.phalconphp.com/en/latest/reference/routing.html
        'default' => [
            'pattern'     => '/:controller/:action',
            'paths'       => ['controller' => 1, 'action' => 2], // Optional
            'httpMethods' => ['GET'], // Optional
            'position'    => 1, // Optional
        ],
    ],
    // register custom service factories implementing the InjectableInterface
    // see: https://github.com/mamuz/phalcon-application/blob/master/src/Application/Service/InjectableInterface.php
    // Key is the name to refer to Phalcon's DI, value is the FQCN of the service factory
    'services' => [
        'user'   => 'User\Service\Factory',
        'logger' => 'Logger\Service\Factory',
    ],
];

// make everything relative to the application root
chdir(dirname(__DIR__));

// Composer Autoloader (see: https://getcomposer.org/doc/01-basic-usage.md#autoloading)
include './vendor/autoload.php';

// bootstrap and run your application
Phapp\Application\Bootstrap::init($config)->runApplicationOn($_SERVER);
```

For more details have a look to the functional tests at based on that [example project](https://github.com/mamuz/phalcon-application/tree/master/tests/_data/StubProject).

### Bootstrapping an application with view support (mostly to response with rendered HTML)

[](#bootstrapping-an-application-with-view-support-mostly-to-response-with-rendered-html)

Check  for using views in Phalcon.

Phalcon's view engine supports the three-step view template pattern. That means you can have a main-layout (outerframe), which includes a controller based layout (frame), which in turn includes an action based layout (innerframe).

Like this:

```

    I am the main layout.

        I am the controller based layout.

            I am the action based layout.

```

So each controller action can have an own template for rendering.

For instance you have a controller with two actions like:

- `User::loginAction`
- `User::logoutAction`

This leads to two view templates located at:

- `{viewbasepath}\user\login.phtml`
- `{viewbasepath}\user\logout.phtml`

Regarding the three-step view template pattern you can place these ones at:

- `{viewbasepath}\index.phtml` (outerframe must be named as index and needs to be placed at the root level)
- `{viewbasepath}\layouts\user.phtml` (frame must be named like the controller and needs to be placed inside layouts folder)

In case of ajax requests (XHR) outerframe and frame rendering is disabled, which means only the innerframe is rendered.

```
$config = [
    'dispatcher' => [
        // define class namespace identifier of your controllers
        'controllerDefaultNamespace' => 'Mvc\Controller',
    ],
    'routes' => [
        // see Router::add in https://docs.phalconphp.com/en/latest/reference/routing.html
        'default' => [
            'pattern'     => '/:controller/:action',
            'paths'       => ['controller' => 1, 'action' => 2], // Optional
            'httpMethods' => ['GET'], // Optional
            'position'    => 1, // Optional
        ],
    ],
    // register custom service factories implementing the InjectableInterface
    // see: https://github.com/mamuz/phalcon-application/blob/master/src/Application/Service/InjectableInterface.php
    // Key is the name to refer to Phalcon's DI, value is the FQCN of the service factory
    'services' => [
        'user'   => 'User\Service\Factory',
        'logger' => 'Logger\Service\Factory',
    ],
    // declare the basepath for the view templates, which enables Phalcon's view engine
    'view' => [
        'templatePath' => './view',
    ],
];

// make everything relative to the application root
chdir(dirname(__DIR__));

// Composer Autoloader (see: https://getcomposer.org/doc/01-basic-usage.md#autoloading)
include './vendor/autoload.php';

// bootstrap and run your application
Phapp\Application\Bootstrap::init($config)->runApplicationOn($_SERVER);
```

For more details have a look to the functional tests at based on that [example project](https://github.com/mamuz/phalcon-application/tree/master/tests/_data/StubViewProject).

### Bootstrapping an application as a command line tool

[](#bootstrapping-an-application-as-a-command-line-tool)

Check  for creating tasks.

```
$config = [
    'dispatcher' => [
        // define class namespace identifier of your tasks
        'taskDefaultNamespace' => 'Command\Task',
    ],
    // register custom service factories implementing the InjectableInterface
    // see: https://github.com/mamuz/phalcon-application/blob/master/src/Application/Service/InjectableInterface.php
    // Key is the name to refer to Phalcon's DI, value is the FQCN of the related service factory
    'services' => [
        'user'   => 'User\Service\Factory',
        'logger' => 'Logger\Service\Factory',
    ],
];

// make everything relative to the application root
chdir(dirname(__DIR__));

// Composer Autoloader (see: https://getcomposer.org/doc/01-basic-usage.md#autoloading)
include './vendor/autoload.php';

// bootstrap and run your application
Phapp\Application\Bootstrap::init($config)->runApplicationOn($_SERVER);
```

### Run a command with arguments

[](#run-a-command-with-arguments)

Let's imagine that the application is bootstrapped inside `index.php`

```
$ php index.php mailing send reminder
```

That will call the `send` action from the `mailing` task with invoking `reminder` as an argument.

### Run a command with arguments and options

[](#run-a-command-with-arguments-and-options)

Let's imagine that the application is bootstrapped inside `index.php`

```
$ php index.php mailing send reminder --sender=foo@bar.com --bcc=baz@bar.com
```

That will call the `send` action from the `mailing` task with invoking `reminder` as an argument. Inside the `send` action the options are aware by `$this->dispatcher->getOptions()`.

For more details have a look to the functional tests at based on that [example project](https://github.com/mamuz/phalcon-application/tree/master/tests/_data/StubProject).

Application Skeleton
--------------------

[](#application-skeleton)

To have a good starting place you should check the [skeleton](https://github.com/mamuz/phalcon-skeleton)which is based on this project.

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity27

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity68

Established project with proven stability

 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

Every ~55 days

Recently: every ~188 days

Total

22

Last Release

2760d ago

Major Versions

v0.1.9 → v1.0.02016-06-08

v1.0.4 → v2.0.02016-09-13

PHP version history (3 changes)v0.1.0PHP &gt;=5.4

v2.0.0PHP &gt;=7.0

v2.1.0PHP ^7.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/c1cf66a1ce705b8bd26f30eb171db09bdd4fae0bc5997acbd747303dbaa3a03c?d=identicon)[mamuz](/maintainers/mamuz)

---

Top Contributors

[![mamuz](https://avatars.githubusercontent.com/u/4173317?v=4)](https://github.com/mamuz "mamuz (57 commits)")

---

Tags

applicationphalconapplicationphalcon

###  Code Quality

TestsCodeception

### Embed Badge

![Health badge](/badges/mamuz-phalcon-application/health.svg)

```
[![Health](https://phpackages.com/badges/mamuz-phalcon-application/health.svg)](https://phpackages.com/packages/mamuz-phalcon-application)
```

###  Alternatives

[phalcon/cphalcon

Phalcon is an open source web framework delivered as a C extension for the PHP language providing high performance and lower resource consumption.

10.8k241.4k1](/packages/phalcon-cphalcon)[phalcon/devtools

This tools provide you useful scripts to generate code helping to develop faster and easy applications that use with Phalcon framework.

1.3k2.0M54](/packages/phalcon-devtools)[phalcon/incubator

Adapters, prototypes or functionality that can be potentially incorporated to the C-framework.

7222.9M81](/packages/phalcon-incubator)[contributte/application

Extra contrib to nette/application

352.8M7](/packages/contributte-application)[phalcon/migrations

Run and Generate DB Migrations with Phalcon Framework

29977.8k6](/packages/phalcon-migrations)[oleksandr-torosh/yona-cms

Yona CMS - open source content management system (CMS). Written in Phalcon PHP Framework (v 1.3.x). Has a convenient modular structure. Has simple configuration and architecture. Can be easily modified for any task with any loads.

3652.1k](/packages/oleksandr-torosh-yona-cms)

PHPackages © 2026

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