I’m a slacker
So, I haven’t made a post in over a year and I feel so bad I want to do an awesome post to make up for it. So, behold, a quick & dirty summary of all my available ZF2 modules. I tend to jump around from module to module depending on my current needs so I’ll try and list the state of each module.
The Modules
I’ll list each module in descending order from how useful I personally think they are. Your own mileage may vary. As always, I’m accepting PR’s so if you want to contribute please do so!
SpiffyNavigation
is aimed to be a replacement for Zend\Navigation once ZF3 comes around. I used a RecursiveIterator with composite pattern to make traversing containers quick. This makes SpiffyNavigation very performant!
It’s missing some view helpers and a few other features like priority but overall it’s pretty solid.
Tests: Yes
Documentation: Yes
Production ready: Yes
SpiffyConfig
is my newest module which is not ready for production but came from my previous work on . The goal of SpiffyConfig is to expedite configuration via annotations without sacrificing performance. It’s hard to explain this one so I’ll use a few examples:
namespace Application\Controller; use SpiffyConfig\Annotation\Controller; use SpiffyConfig\Annotation\Route; use SpiffyConfig\Annotation\Service; use Zend\Mvc\Controller\AbstractActionController; /** * @Controller\Invokable(name="index") * @Service\Invokable(name="index", key="controllers") * @Route\Generic(type="literal", action="index", name="home", mayTerminate=true, options={"route":"/"}) */ class IndexController extends AbstractActionController { public function indexAction() { } /** * @Route\Literal("/child1", parent="home", name="child1") */ public function testAction() { } /** * @Route\Segment("/child2/:id", parent="home/child1", name="child2", mayTerminate=true, options={"constraints":{"id":"\d+"}}) */ public function anotherAction() { } }
I know that’s a lot of stuff to figure out but give me a few days and I hope to have some documentation up that explains everything.
Tests: No
Documentation: No
Production ready: No
SpiffyAuthorize
aims to be a replacement for ACL/RBAC solutions by implementing into them into a single code base. Right now, only RBAC is setup, but I’m open to PR’s from anyone wanting to add ACL implementation.
Tests: Yes
Documentation: Yes
Production ready: No
SpiffyCrud
is a solution for RAD of CRUD operations. I took some ideas from Django’s admin tool and tried to come up with a system that is easy to use but also offers full customization should the need arise.
Tests: No
Documentation: Some
Production ready: No
SpiffyDatatables
is a thin wrapper around jQuery Datatables and is used as the default renderer in SpiffyCrud.
Tests: No
Documentation: No
Production ready: Yes
SpiffyTinyMce
is a thin wrapper around TinyMCE.
Tests: No
Documentation: No
Production ready: Yes
SpiffyConnect
is a module I wrote to replace HybridAuth because anyone whose worked with HybridAuth knows it’s a gigantic pain in the ass. It features a simple, consistent, API for multiple providers. I was building this for a work project which was canceled so I stopped development but the core features are in and I would love to pick this back up at some point.
Tests: No
Documentation: Some
Production ready: No
SpiffyUser
is YAUM (Yet Another User Module). I was working on a rewrite of ZfcUser but supporting multiple backends is a problem that is not easily solved so I instead chose to focus on Doctrine and PHP 5.4 to take advantage of traits and the power they bring to Doctrine. That said, it is possible to get SpiffyUser working with Zend\Db if you create your own ObjectManager and ObjectRepositories.
SpiffyUser aims to keep a very slim core and provide features through the use of extension modules. The entire API is heavily event driven. All extensions are enabled if installed and disabled if uninstalled. This reduces the need to modify configuration.
If anyone wants to pick up the work I did on ZfcUser all the modules are available on my GitHub. Feel free to fork them and take them over.
Tests: No
Documentation: No
Production ready: No
SpiffyUserRemember
is an extension for SpiffyUser that provides simple remember me cookie support.
SpiffyUserMetadata
is an extension to provide additional user metadata. This extension is no longer required due to the architecture of SpiffyUser but I left it listed for brevity.
SpiffyUserAuthorize
integrates SpiffyUser and SpiffyAuthorize into a unified system.
SpiffyTest
is a simple module that bootstraps the Zend\Mvc\Application and Zend\ServiceManager\ServiceManager and provides custom module.config.php and application.config.php files for use in a testing environment. Most of my modules that have tests use this as.
Show & Tell
Combining SpiffyConfig, SpiffyCrud, and SpiffyDatatables into one system let’s me do the following.
namespace SpiffyPage\Controller; use SpiffyConfig\Annotation\Controller; use SpiffyConfig\Annotation\Route; use SpiffyCrud\Controller\AbstractCrud; /** * @Controller\Invokable * @Route\Generic(name="spiffypage.admin", type="crud", options={"route":"/admin/pages"}); */ class PageAdmin extends AbstractCrud { /** * @var string */ protected $modelName = 'SpiffyPage\Crud\Model\Page'; /** * @var string */ protected $route = 'spiffypage.admin'; }
namespace SpiffyPage\Crud\Model; use SpiffyConfig\Annotation\Service; use SpiffyCrud\Model\AbstractModel; /** * @Service\Invokable(key="spiffy_crud|manager") */ class Page extends AbstractModel { /** * @var string */ protected $displayName = 'Pages'; /** * @var string */ protected $entityClass = 'SpiffyPage\Entity\Page'; }
In Closing
I hope you enjoy using ZF2 as much as I do! If you have, or are considering writing, a module that is similar in scope to any of the ones I listed above please consider contacting me or submitting PR’s so that we can collaborate. Two heads are better than one! Also, I listed several modules above as not ready for production primarily due to the lack of tests and documentation but every module listed above does function.