Download the PHP package tfhinc/ci-newton without Composer

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

Newton

Latest Version on Packagist PHP Version Total Downloads

Simply Observe - Newton allows you to Subscribe and Listen for Event Broadcasts in the Codeigniter framework.

Installation

Run the post install publish-files command to publish the config, helper and library class files to the appropriate CI directories:

Loading the Library

There are a few available options for loading the Newton library:

Using the newton() helper function

The Newton helper function will resolve the Newton class via the CI instance. It will either load the class or return the existing class instance:

Using the Newton Class

The Newton class can be instantiated via namespace:

Using the Newton CI Library

The Newton class can be loaded like any other CI library:

Class Structure

The Newton library allows for Listener classes to subscribe to Event class broadcasts. This helps decouple your business logic into single purpose Listener classes that can be invoked en masse by the broadcast of an Event.

Event Classes

The Event class defines the properties that a given event will require and receive where there is a broadcast. The Event class does not contain any business logic - think of it as a blueprint of required data for a given event.

application/events/UserCreatedEvent.php

Listener Classes

The Listener class contains the business logic that will be performed when a subscribed Event is broadcast. The Listener class will receive an instance of the Event class, which includes the event properties for usage in your business logic:

Note that the Listener class must extend the TFHInc/Newton/NewtonListener abstract class.

application/listeners/SendAdminEmailListener.php

application/listeners/UpdateUserStatsListener.php

Subscriptions

You can subscribe Listener classes to the Event classes. This means when the Event is broadcast the subscribed Listener classes wil be invoked via reflection. There are two ways to subscribe Listeners to Events:

Via Configuration File

Via Subscribe Method

Broadcasting Events

An Event can be broadcast via the broadcast() method using the Newton library or newton() helper function:

In this example the UserCreatedEvent class will be instantiated and in turn, instantiate the subscribed classes SendAdminEmailListener and UpdateUserStatsListener.

Contributing

Feel free to create a GitHub issue or send a pull request with any bug fixes. Please see the GutHub issue tracker for isses that require help.

Acknowledgements

License

The MIT License (MIT). Please see License File for more information.


All versions of ci-newton with dependencies

PHP Build Version
Package Version
Requires php Version >=7.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 tfhinc/ci-newton contains the following files

Loading the files please wait ....