Download the PHP package corneltek/actionkit without Composer

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

ActionKit

Coverage Status Build Status Latest Stable Version Total Downloads Latest Unstable Version License

ActionKit is a library that let you share the business logics across controllers, pages, ajax requests.

Sometimes, you need to reuse code across your controllers, pages, ajax requests, you might sit down and write a shared controller class to share the common code for reuse. This approach might work well for small applications, , however, when your application is getting bigger and bigger, it will be very complex to share the common code, and hard to maintain.

ActionKit provides a way to wrap your common code up, and make these common code reuseable in everywhere in the application.

Besides of sharing the logics across your controllers, you may also define the parameters with types, validators, form widget type and a lot of parameter options, and render your Action as a web form.

[Web Form] => [Input: paramters] => [ Parameter Validation ] 
        => [Execute the logic in Action]  
            => [Return result: Success or Failure, Data: processed data]
                => [Render result on the web page]

Hence, you don't need to handle the ajax mechanisums, controller handlers, parameter validations, ActionKit\Action does all the jobs for you automatically, so you can focus on the core logics that you only need to handle.

Action is just like API (application programming interface), which can be triggered from HTTP requests, Ajax requests, or from backend, here is the work flow:

ActionKit - PHP

A Basic Action

A minimal action skeleton:

To use Action, you should define a run method at least, in this run method, you write your logics, operations, then return the result at the end.

To report success result, you can simple use success method:

You can also pass data to the action result, by appending another argument in array:

To report error:

Action Signature

To trigger an action from front-end, you can define an action signature in your HTML form.

When submitting this form, ActionRunner uses this signature to dispatch your action to the right place.

The convention rule is like below:

A Simple Action Skeleton

Then the caller:

To take an action, simply call invoke method to trigger the action.

the invoke method trigger runPreinit, runInit, beforeRun, run, afterRun in order.

Action Schema

run method

methods

methods that you will use in run:

properties

properties that you will need in Action run method:

Action param methods

Action Result

After executing an action, the action creates an action result object inside itself, you can retrieve the action result object through the getResult() method of action object to see if it's successfully executed or encountered an error.

Every action result object is saved in the ActionRunner instance. (the action result pool, which is a singleton object)

You can also fetch action result objects from ActionRunner.

An ActionResult object contains a flag (success or error), a message string, a data stash.

Here is a simple example to check the result error:

To get an action result from an action object.

To get an action result from ActionRunner:

RecordAction

Record Action is very useful for connecting ORM with front-end form, Record Action passes arguments to model object and validates the arguments from HTTP request.

If all validation passed, and no PDOExcetion was catched, the action result will be generated and ready to send back to front-end.

There are 3 type record actions, which is mapped to CRUD operations:

  1. Create
  2. Update
  3. Delete

The mapped action classes are:

  1. CreateRecordAction
  2. UpdateRecordAction
  3. DeleteRecordAction

Those 3 record action classes inherits BaseRecordAction class.

BaseRecordAction class provides most methods for glueing ORM interface methods and the result data conversion.

RecordAction Synopsis

Messages

The BaseRecordAction provides the default message interface, to override these messages (for both success and error message) you can simply override the methods:

RecordAction Examples

CreateNews

UpdateNews

Record Action API

RecordAction schema methods

Record Action Generator

CRUD Actions could be automatically generated, or be manully created by hands.

To generate CreateRecordAction from a model class name

To generate UpdateRecordAction from a model class name

To generate custom action:

Or even shorter (???):

Or create record actions from record object:

Action Widget

Action widgets depends on the parameter definition, the default widget type is TextInput.

In action schema, the parameters you defined can generate form widgets (with FormKit) automatically.

What you only to do is to define a renderAs attribute for your parameters in your action schema.

For example:

And then, to get the form widget through Action object, you can do:

And to render it:

For other type widgets, like SelectInput you can specify options:

You can also force a form widget type for widget method, which will override the widget type that you defined previously:

Action View

An action view may contains a formkit layout builder, but an action view build everything for you.

to create an action view, you can simple calls the createView method

Action rendering throught built-in StackView

By using ActionKit StackView, you don't need to write HTML, the form elements are automatically generated.

Here is a StackView synopsis:

Use case:

And you can render action view via Action's asView method:

So that if you're in Twig template, you can do:

You can also pass extra options to View class:

Action Rendering (render by pure HTML elements)

You can simply render a HTML form to trigger corresponding action class, in this example we trigger the User\Action\UpdateUser action, which is generated automatically through the Dynamic Action Generator.

Action Rendering and Action.js integration

<script>
    $(function() {
        Action.form( $('#profile')).setup({
            validation: "msgbox",
            status: true
        });
    });
</script>

{{ Web.render_result( update.signature ) |raw}}

{{ update.asView('ActionKit\\View\\StackView',{ 
        'form_id': 'profile' 
    }).render() |raw }}
</div>

Action Rendering (render field by field)

In controller, you can initialize a action object:

Then in template, you can call action API to render these fields by these methods, eg renderSignatureWidget , renderWidget , renderLabel , renderSubmitWidget..etc:

Front-end Action API

You can execute Actions from front-end, it's more like an API. to send action to execute, you need to include action.js from action assets.

action.js provides a short helper named runAction that helps you to execute Action, you can call runAction function in following forms:

runAction( {Action Signature}, {Arguments});
runAction( {Action Signature}, {Arguments} , {Options});
runAction( {Action Signature}, {Arguments} , {Options}, {Callback} );
runAction( {Action Signature}, {Arguments} , {Callback} );
runAction( {Action Signature}, {Callback} );
runAction( {Action Signature} );

And in the below example, we send Stock::Action::DeleteTransaction to backend with a record id to delete a transaction record, if it's successful, then fade remove the elements from HTML.


All versions of actionkit with dependencies

PHP Build Version
Package Version
Requires corneltek/cascading-attribute Version ^1
corneltek/fileutil Version ^1.7
corneltek/universal Version ^1.8
corneltek/imagekit Version ^1
corneltek/class-template Version ^3.0.0
corneltek/formkit Version ^1
phifty/locale Version ^3
twig/twig Version ^1
pekkis/mime-types Version ^1
pimple/pimple Version ^3.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 corneltek/actionkit contains the following files

Loading the files please wait ....