DEV Community

Jitendra
Jitendra

Posted on

Batteries for Phalcon PHP framework

So you use phalconphp and like the speed and simplicity of it but miss some cool things and neat ways to do something? I did too. So I ended up writing a thin plug and play wrapper for phalcon that does basically many of the things you wished were in phalcon already.

GitHub logo adhocore / phalcon-ext

Foundations, adapters, extensions, middlewares and utilities for Phalcon

adhocore/phalcon-ext

Useful phalcon adapters, middlewares, extensions and utilities!

Travis Build Latest Version Scrutinizer CI Codecov branch StyleCI Software License Donate 15 Donate 25 Donate 50 Tweet

Installation

composer require adhocore/phalcon-ext
Enter fullscreen mode Exit fullscreen mode

What's included

Cache

Cli

Db

Di

Http

Logger

Mail

Util

Validation

View


Cache.Redis

Extends Phalcon\Cache\Backend\Redis to allow access over the underlying redis binding.

Setup

$di->setShared('redis', function () {
    return new \PhalconExt\Cache\Redis(new \Phalcon\Cache\Frontend\None(['lifetime' => 0]));
});

// Call native \Redis methods like:
$di->get('redis')->getConnection()->hGet();
$di->get('redis')->getConnection()->info();
Enter fullscreen mode Exit fullscreen mode

Cli.Extension

Definitely check how it works in adhocore/cli and how it is integrated & used in example/cli, example/MainTask.php

Setup

Enter fullscreen mode Exit fullscreen mode

Ignite your phalcon app with this multipurpose library. It is a collection of extensions/adapters/middlewares and utilities to make development with phalcon fun, elegant and easy. You can also build cool console interfaces and schedule tasks like a pro :)

What's included

  • powerful dynamic di resolver
  • common middlewares (cache, auth, cors, throttle ...) for the web and console
  • a well architected middlware pattern common for both micro+mvc app
  • extra logging utilities
  • mailer on top of swiftmailer
  • easy to use validation: the same way we all did in laravel before and loved it
  • thin twig bridge so you can use twig template natively alongside volt
  • neat, powerful argv parser for cli and task scheduler
  • jwt auth for APIs (as middleware) if you like
  • query logger with full control of traces

Besides, It has fully covered test cases, complete documentation and illustrative examples for many usecases. And not to mention it gracefully mediates the parity of doing things in mvc or micro mode presenting you one consistent common approach.

Scrutinizer score: 10/10

Thanks for reading, please try out and give some feedbacks. Any contribution would be received with thanks.

Happy hacking. :)

/Ahc

Top comments (3)

Collapse
 
biros profile image
Boris Jamot ✊ /

Hi! a few years ago, I was wondering which PHP framework I'll be using in my new project. I had the choice between Symfony, Laravel, Slim & others, but I also discovered Phalcon.
Finally, I choose Slim because I don't like big frameworks & ORM, but I'm still interested in Phalcon and 4 years after, it seems to become widely adopted in the PHP world.
What is your opinion about Phalcon? For which use-cases do you use it? Did you ever built a serious application on top of it?

Collapse
 
adhocore profile image
Jitendra

yes we use parts of it in quite big phalcon app and so far so good. would love to hear what you build using this extension, and in case there is hiccups which you believe comes from this one, please file the issue in repo and i would do my best to help/fix.

Collapse
 
biros profile image
Boris Jamot ✊ /

Unfortunately, I never used Phalcon yet, but I keep it in mind for a further project.