Download the PHP package adhocore/phalcon-ext without Composer

On this page you can find all versions of the php package adhocore/phalcon-ext. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package phalcon-ext

adhocore/phalcon-ext

Useful phalcon adapters, middlewares, extensions and utilities!

Supports phalcon v4.

Travis Build Latest Version Scrutinizer CI Codecov branch StyleCI Tweet Support

Installation

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


Cli.Extension

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

Setup

command(string $command, string $descr = '', bool $allowUnknown = false): Ahc\Cli\Command

You can register command in the bootstrap if few or you can organise them in SomeTask::onConstruct() like so:

Now everytime you run command php cli.php main main the-path --stuff whatever, it will print the-path and whatever! cli.php can be anything of your choosing that should be equivalent to example/cli.

initTasks(void): self

Inits the loadable tasks. It is done automatically if you have listed them in console.tasks config (see Setup section above). If you have loaded tasks dyanamically or late in the process call it manually: $console->initTasks().

Cli.MiddlewareTrait

Enables you to define, register and fire middlewares for the cli in simplest possible way! PhalconExt/Cli/Middleware/Factory is registered by default for convenience. It injects relevant command instance (Ahc\Cli\Input\Command) to DI and is auto triggered for --help, --version.

Define middleware

Register/retrieve middleware(s)

Firing middlewares

You dont have to. The before and after methods of all middlewares are automatically invoked as console lifecycle event.

Cli.Task.ScheduleTask

Being factory feature of adhocore/phalcon-ext it is auto loaded so you dont have to put in config's console.tasks array.

It provides for commands schedule:list (or schedule list) and schedule:run or schedule run to respectively list all scheduled commands and run all commands due at that specific moment.

Registering tasks to be scheduled is a cheese too. Check command() section above, you can schedule a task in fluent interface like so:

As you can see, all you need to do in crontab is add the entry: * * * * * php /path/to/your/phalcon-app-using-phalcon-ext/src/cli.php schedule:run ... and manage everything here in the code!

Caution

Any tasks scheduled to run by automation like this should preferably not define required arguments or options of the form <name>, as firstly they are not validated when being run as scheduled task, and secondly the philosphy of scheduling is to register single crontab script * * * * * php /app/src/cli.php schedule:run with no any args/options. (and these are made to run unattended if you want third point!)

However if you insist, it is possible to append --option-name value after schedule:run segment but this value goes to all of the due tasks runnable at the moment. They all can read it with $this->command->optionName.


Db.Extension

Setup

upsert(string $table, array $data, array $criteria): bool

Insert or update data row in given table as per given criteria.

insertAsBulk(string $table, array $data): bool

Insert many items at once - in one query - no loop.

countBy(string $table, array $criteria): int

Count rows in table by criteria.

Db.Logger

Hook into the db as an event listener and log all the sql queries- binds are interpolated.


Di.Extension

Foreword This whole example and the entire phalcon-ext package almost always used $di->get('service') and not $di->getShared('service'), this is because if you have set 'service' as shared, get() will return that same shared instance again and again and if not then it will spawn new instance- the point is if we dont want new instance why dont we setShared() it? One has to consciously think whether to setShared() or set() instead of getShared() or get().

Setup

registerAliases(array $aliases): self

Register aliases for di service so they can be resolved automatically by name &/or typehints.

resolve(string $class, array $parameters = []): mixed

Recursively resolve all dependencies of a given class FQCN and return new instance.

replace(array $services): self

Override a di service but keep backup so it may be restored if needed (great for tests)

restore(?string $service)

Restore the overridden services to their usual defaults.

Di.ProvidesDi

di(?string $service): mixed

Easily resolve di services with this shortcut.


Http.BaseMiddleware

A base implementation for middlewares on top of which you can create your own middlewares. You just have to implement one or both of before() &/or after() methods that recieves request and response objects. See an example for Ajax middleware:

Http.Middleware.ApiAuth

JWT based api authentication middleware that intercepts POST /api/auth request and generates or refreshes access_token based on grant_type. For all other requests it checks Authorization: Bearer <JWT> and only allows if that is valid and the scopes are met. You can configure scopes on per endpoint basis. You can access currently authenticated user through out the app using:

Setup

Http.Middleware.Cache

Caches output for requests to boost performance heavily. Requires redis service. Currently by design only GET requests are cached and this might change.

Setup

Http.Middleware.Cors

Enables cors with preflight for configured origins and request options.

Setup

Http.Middleware.Throttle

Throttles the flooded requests as per time and quota of your choosing. Requires redis service.

Setup

Usage

Middlewares can be used as a wrapper to app using PhalconExt\Http\Middlewares manager.


Logger.EchoLogger

log(string $message, int $type, array $context = [])

Echoes anything right away - but you can control formatting and log level.

Logger.LogsToFile

log(string $message, int $type, array $context = [])

Delegate mundane file logging task to this trait thereby cutting down boilerplate codes.


Mail.Mailer

A Phalcon adapter/bridge/container/delegator (read: abcd) to swiftmailer.

Setup

Mail.Mail

A child of swiftmail message to allow attaching attachments without much ado.

Mail.Mailable

mail()

Like Logger.LogsToFile above, but for mails.

Mail.Logger

Automatically logs all sent mails into file as a swiftmailer event listener- you can choose log formats: eml | html | json.

Setup


Util.OpcachePrimer

prime(array $paths): int

Ensures to warm up opcache for all files in given path well before file exceution. Opcache caches are specific to the sapi it is run. So for web, you need to have an endpoint


Validation.Validation

Validate data like we did in elsewhere- setting rules as .well-known strings or key=>value pairs (array).

Setup

register(string $ruleName, $handler, string $message = ''): self

Register a new validation rule.

registerRules(array $ruleHandlers, array $messages = []): self

Register many new validation rules at once.

Usage

Validation.Existence

Validates if something exists in database. You can optionally set table and column to check.


View.Twig

Use twig view natively in Phalcon

Setup

Usage


You can also see the more.

Related Projects

License

© 2017-2020, Jitendra Adhikari | MIT

Credits

This project is release managed by please.


All versions of phalcon-ext with dependencies

PHP Build Version
Package Version
Requires php Version >=7.0
adhocore/jwt Version ^1.0
adhocore/cli Version ^0.8.1
adhocore/cron-expr Version ^1.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package adhocore/phalcon-ext contains the following files

Loading the files please wait ....