Download the PHP package rustphp/ding without Composer

On this page you can find all versions of the php package rustphp/ding. 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 ding

Introduction

Please contact me if you have any comments, doubts, or any kind of feedback. Send an email to: [email protected]

Checkout the api (phpdoc) at: http://marcelog.github.com/Ding/php-doc/html/index.html

In the homepage, you can find the user manual: http://marcelog.github.com/Ding

Ding is also the winner of the 2011 Binpress programming contest :)

See these articles for a complete application example:

Please see inside docs/examples for code samples. A good place to start are the "basic", "aop", "quickstart", "doctrine", and "mvc" examples.

Upgrading note

If you are upgrading from <= 1.1 to 1.3, please see README.1.3.x.

Supported Dependency Injection annotations:

or

pear install marcelog/Ding-1.6.3

just replace 1.6.3 by the release version you'd like to install :) See: http://pear.marcelog.name/

Note: A version 1.2.x was erroneously released because of a misconfiguration of the pear channel. To avoid more confusions about the correct versions, 1.2.x will not have any releases. So versions jump from 1.1.x to 1.3.0. If you happen to have a 1.2.0 version installed, please update the pear channel and download the latest version.

PHAR File

Just go to the Jenkins server at http://ci.marcelog.name and grab the latest phar distribution from the Ding job.

Supported bean definitions providers

See these: http://marcelog.github.com/articles/ding_component_bean_annotations.html http://marcelog.github.com/articles/ding_component_bean_annotations_di_dependency_injection.html

Each one of the implementations can be used for bean caching, beandefinition caching, or proxy caching. Actually, caching beans is a little trickier in the php world. In the java world, the application server is always "up & running", whilst in php everything is created from scratch for every request. So it may be better to not cache the bean itself, but everything else, like definintions and proxies definitions.

DI

Aware Interfaces

IContainerAware: Whenever ding is going to instantiate a bean whose class implements IContainerAware interface, it will inject the container instace to this bean.

IBeanNameAware: Whenever ding is going to instantiate a bean whose class implements IBeanNameAware interface, it will inject the bean name.

IAspectManagerAware: Whenever ding is going to instantiate a bean whose class implements IAspectManagerAware interface, it will inject the current instance of the aspect manager (giving the ability to inject pointcuts, aspects, and general aop management).

IResourceLoaderAware: Whenever ding is going to instantiate a bean whose class implements IResourceLoaderAware interface, it will inject the instance of the resource loader in use, which is usually the container itself.

ILoggerAware: Whenever ding is going to instantiate a bean whose class implements ILoggerAware interface, it will inject the instance of the logger (log4php) in use by the container, so you can log there. The returned logger will be of class CLASS (where \ are replaced with .).

IReflectionFactoryAware: Whenever ding is going to instantiate a bean whose class implements IReflectionFactoryAware interface, it will inject the instance of the reflection factory in use.

Extension points

You can easily hook in the bean lifecycle by just implementing one of:

If you want to provider beans yourself, just have a bean implement the Ding\Bean\IBeanDefinitionProvider interface, it will automatically be registered in the container and will be called whenever a new bean definition is demanded.

If you want to provide aspects and pointcuts, just implement one or all of:

The container will automatically register your bean in the aspect manager and will be called to get any new aspects/pointcuts when needed.

Events

The container natively supports events. This means that you can register beans (either programatically or via the xml, yaml, or annotations drivers) and then asynchronously trigger (dispatch) these events along some data object. The container will then instantiate the needed beans (the listeners) and notify them. Please see docs/examples/events for an example using xml, yaml, and annotations.

You can also see this article about working with events: http://marcelog.github.com/articles/ding_event_listen_dispatch_bean.html

AOP

Aspects work via an implementation of the interceptor pattern. There are 2 available interceptors, both of them available in xml, yaml, and annotation drivers.

See this article for more information: http://marcelog.github.com/articles/ding_php_aop_aspect_oriented_programming.html

MVC

The mvc is work in progress, but you can sneak peek it in docs/examples/mvc. You will need a rewrite rule, like (for lighttpd):

url.rewrite-if-not-file = ( ".\?(.)$" => "/example.php?$1", "" => "/example.php" )

For Apache: RewriteRule ^(.*)$ /example.php/$1

The example is mapped to /Some/Mapped/Path/MyController/some (hint: try it with ?optional=value). If you press the button, the form will be submitted and handled by another action that will print the same data, but now for the post instead of the initial get.

Also, if you want to trigger an exception to see the exception handler in action, point your browser to: /Some/Mapped/Path/MyController/someException

To try a redirect (no view render, just headers sent), point your browser to /Some/Mapped/Path/MyController/redirect This uses an http header 302.

To try an internal redirect (forward), point your browser to /Some/Mapped/Path/MyController/forward. This will internally forward the request to another controller/action.

To try annotated controllers (see below), point your browser to /Some/Mapped/Path/MyAnnotatedController/an.

MVC Annotations

You can use @Controller and @RequestMapping in your classes and not declare them in beans.xml file. see docs/examples/mvc/annotatedController

You can also use Twig to render the views. see docs/examples/mvc-twig You can also use Smarty to render the views. see docs/examples/mvc-smarty

Pre And Post Dispatch Interceptors

You can hook before dispatching a request to a controller and also after. A dispatcher will chain all preHandle() and postHandle() from all the IHandlerInterceptor you configure.

A preHandle() interceptor returning true will continue the chain execution. To stop the chained execution, false can be returned, and also a ModelAndView (thus, triggering redirects, view renders, etc).

You can find an example in docs/examples/mvc-interceptors

TCPClient

You can use the helper TCPClientHelper as just another bean. Via callbacks and combining the helpers for error and signal handling, you can easily create a very complete tcp client, using non blocking sockets. Available callbacks:

You can specify the connection timeout, the read timeout (both in milliseconds) and the minimum needed bytes in the socket before considering it as available data to be read.

see docs/examples/tcp for an example of use.

When using non blocking connects, be aware that php will call your error handler with an "operation in progress" message that is completely normal but it seems there is no way to disable it without interferring with other messages :(

TCPServer

You can use the helper TCPServerHelper as just another bean. Via callbacks and combining the helpers for error and signal handling, you can easily create a very complete tcp server, using non blocking sockets. Available callbacks:

You can specify the connection timeout, the read timeout (both in milliseconds) and the minimum needed bytes in the socket before considering it as available data to be read.

see docs/examples/tcp for an example of use.

Error Handling

If you declare a bean to listen for event "dingError", it will be called when the container receives an error (same effect as using set_error_handler() by yourself, only much easier!)

Signal Handling

If you declare a bean to listen for event "dingSignal", it will be called when the container receives a signal, the signal number will be passed as the argument. Only available for SAPI's cli and cgi. Requires the pcntl extension.

Shutdown Handling

If you declare a bean to listen for event "dingShutdown", it will be called when the container shutdowns (same effect as using register_shutdown_function()).

HttpSession

A helper so you can access the session from the mvc. You can setAttribute()'s and getAttribute()'s, destroy() it, etc. See the mvc example.

PAMIHelper

This helper integrates PAMI (https://github.com/marcelog/PAMI) with Ding, offering a quick, easy, and effective way to access and manager asterisk installations via the asterisk manager interface (ami).

See: docs/examples/pami

PAGIHelper

This helper integrates PAGI (https://github.com/marcelog/PAGI) with Ding, offering a quick, easy, and effective way to make agi (Asterisk Gateway Interface) applications (PrePaid systems, voicemail's, etc).

See: docs/examples/pagi

In order to run the example, you need something like this in your dialplan:

[default] exten => _X,1,AGI(/tmp/Ding/docs/examples/pagi/run.sh,a,b,c,d) exten => _X,n,Hangup

Call to extension 1 and extension 2 (modify the example if you want another extensions). Use other digit to invoke the default extension.

Syslog

Try the SyslogHelper to easily add syslogging to your own application. See docs/examples/syslog.

Integration with other frameworks

See our doctrine2 integration: https://github.com/marcelog/Ding/tree/master/docs/examples/doctrine

Developers

Of course it is recommended that you do not set DEBUG output in your log4php configuration (or remove it from the include path so Ding will notice and not use it). This will create a difference in performance.

Performance tips


All versions of ding with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.3
pear-log4php/apache_log4php Version >=2.1.0
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 rustphp/ding contains the following files

Loading the files please wait ....