1

How feasible is it to use the Zend Framework 2 components without using the MVC process? For example I love the forms / validation and ACL elements but am not sure if that is actually possible without the whole MVC system?

As a framework ZF2 is very slow (although I think its a very good system) so would like to encourage its use without the whole package. Thanks.

edigu
  • 9,878
  • 5
  • 57
  • 80
Antony
  • 3,875
  • 30
  • 32

1 Answers1

1

Yes. Zend Form component has a separate repository and it can be used in any application as a component with help of composer. (I'm assuming that you're using composer and your application also uses composer's autoloader) It requires only InputFilter and Stdlib components.

You can try easily. Open your command line:

$ cd /path/to/an-empty-folder

Create a composer.json file with the content below

{
    "name": "Form Demo App",
    "require": {
        "php": ">=5.4",
        "zendframework/zend-form": "2.3.*@dev"
    }
}

and after type

$ composer update

Following dependencies will be installed automatically into the vendor directory and composer.lock will be created :

Loading composer repositories with package information
Installing dependencies (including require-dev)
  - Installing zendframework/zend-stdlib (2.3.3)
    Downloading: 100%         

  - Installing zendframework/zend-validator (2.3.3)
    Downloading: 100%         

  - Installing zendframework/zend-filter (2.3.3)
    Downloading: 100%         

  - Installing zendframework/zend-inputfilter (2.3.3)
    Downloading: 100%         

  - Installing zendframework/zend-form (2.3.3)
    Downloading: 100% 

From performance viewpoint, ZF2 is not very slow. You just need to do couple of things on production environment to run your application much more more performant.

Community
  • 1
  • 1
edigu
  • 9,878
  • 5
  • 57
  • 80
  • Thanks for your answer. A couple of points - firstly I wouldn't be using composer so is it possible just using files / includes? Secondly thanks for the links. The issue with those points (not saying your links are bad!) is that any Opcaching will always help improve performance on a framework (however the other points about class mapping is interesting). Statistically whenever I see comparisons Zend generally comes out super slow (even though I think its a great framework) so in production we have purposefully held off using it. I think the problems are inherent with the framework. – Antony Nov 15 '14 at 21:52
  • There are lot of metrics exists to calculate overall software quailty like reliability, testability, maintainability, security, scalability, portability, development cost, usabilty etc... Not only efficiency. This is a tradeoff. ZF2, Symfony 2, Doctrine 2 all of them are good frameworks and libraries with some tradeoffs. Your most important focus should not only performance if you're not writing a single page hello world app, never. – edigu Nov 16 '14 at 08:44