Download the PHP package telnowedge/freepbx-base without Composer
On this page you can find all versions of the php package telnowedge/freepbx-base. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download telnowedge/freepbx-base
More information about telnowedge/freepbx-base
Files in telnowedge/freepbx-base
Package freepbx-base
Short Description Helper to create module with the Symfony components like form validation, dependency injection...
License Apache-2.0
Informations about the package freepbx-base
TelNowEdge/FreepbxBase bundle
Version
-
2018/05/23 <1.0>: Stable release
- Container caching
- Template caching
- Form helper to append Destination block on form
- Helper to send UserEvent
- New Verb forn asterisk dialplan
- 2017/11/28 <0.1>: First available working version
Install
Dependencies requirements
Currently FreePBX® come with a symfony/property-access:3.4.19 on this version a major bug is known #29340. So, to install this module you must update your packages.
With composer require
With git
git clone inside composer vendor dir
Update composer autoload by adding on composer.json
And finally run
To known
- Cache system
All cached files was written on rootFreePBX
/assets/cache/. Please take care with the rights.
Overview
This FreepbxBase bundle provide an easy way to write FreePBX® modules like an MVC project. He works alone without any modification of FreePBX® core files except composer.json.
FreepbxBase bundle use Symfony® components to improve security, accessibility and support.
It register its own namespace to give access on the different components through several helpers.
FreepbxBase bundle introduce in FreePBX® the Dependency Injection concept with the Symfony® component. This component is very useful to prevent any singleton
and share easily your object through your own code.
FreepbxBase bundle provide too the Symfony® Form component to validate your form on the server side before to save it on your sql storage.
Before start using it, you need to understand namespace and the Symfony base development concepts.
Acme example module
Coding standard
To check the coding standard
please include on your module GrumPHP.
-
Require packages
-
Create config file for
php-cs-fixer
./php_cs
- Create GrumPHP config file
./grumphp.yml
Included components
- doctrine/annotations
- doctrine/cache
- guzzlehttp/guzzle
- monolog/monolog
- symfony/cache
- symfony/config
- symfony/dependency-injection
- symfony/event-dispatcher
- symfony/form
- symfony/http-foundation
- symfony/ldap
- symfony/property-access
- symfony/security-csrf
- symfony/serializer
- symfony/twig-bridge
- symfony/validator
- symfony/yaml
How to use
Start a new FreePBX® module
Start a new FreePBX® module like FreePBX® practices and change only the extends
class to TelNowEdge\FreePBX\Base\Module\Module
.
This extends start and bridge all Symfony® components and register a new namespace. Now you can use a PSR4 namespace inside your module.
The new register namespace is \TelNowEdge\Module
. He is registered with ./modules
base directory. So now you can use \TelNowEdge\Module\foo
namespace.
Note:
Take care with the case of your module name. Your class can be Foo.class.php but the folder is ./modules/foo. So the namespace is \TelNowEdge\Module\foo.
Use FreePBX® class like an entry point
Your Foo.class.php
is the first file for FreePBX®. Now use it to call your logic Controller.
Your controller ./modules/foo/Controller/FooBarController.php
Reference
Module
Entry point to start FreepbxBase bundle.
FreePBX® module must extends TelNowEdge\FreePBX\Base\Module\Module
Controller
Your Controller must extends TelNowEdge\FreePBX\Base\Controller\AbstractController
-
Render return the compile html from the template. Append on FreePBX® with the FreePBX® practices.
- get()
Model
Note:
This bundle don't use Doctrine ORM. But the way is the same.
Model
is the Database representation. This class must not extends anything.
On each properties, you can add a validator.
Repository
Repository
get informations from sql storage and map with Model. ORM like very lite.
Your Repository must extends TelNowEdge\FreePBX\Base\Repository\AbtractRepository
-
sqlToArray() Transform sql results set to an array for
objectFromArray()
sqlToArray()
need a formatted input.sqlToArray()
return an associative array like:Note:
The _ was remove to create table key and was camel case.
- objectFromArray()
Map the
sqlToArray()
to the model. On each properties, he try to call the setter.
DbHandler
DbHandler
save data from the Model
to the sql.
Your Repository must extends TelNowEdge\FreePBX\Base\Handler\AbtractDbHandler
Form
Form
provide an easy way to build and validate your form.
This component is used exactly like Symfony does.
Validator
Validator
works with Form
to validate it on server side.
This component is used exactly like Symfony does.
Dependency Injection
Dependency Injection
create a container of services to deal with on your code.
This component is used exactly like Symfony does.
Twig
Twig
is a templating component. Cery useful to render the Symfony® forms
This component is used exactly like Symfony does.
Todo
- Increase security in service.yml with public / private service
All versions of freepbx-base with dependencies
doctrine/cache Version ^1.6
guzzlehttp/guzzle Version ~6.0
monolog/monolog Version ^1.23
symfony/cache Version ^3.4
symfony/config Version ^3.3.3
symfony/dependency-injection Version ^3.3.3
symfony/event-dispatcher Version ^3.3.0
symfony/form Version ^3.3.10
symfony/http-foundation Version ^3.0.9
symfony/ldap Version ^3.4
symfony/property-access Version ^3.4.27
symfony/security-csrf Version ^3.3.10
symfony/serializer Version ^3.0.3
symfony/twig-bridge Version ^3.3.10
symfony/validator Version ^3.0.9
symfony/yaml Version ^3.0.3