Download the PHP package sparky-spa/sparky without Composer

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

The tool to develop Single Page Applications on PHP

Easy to start, easy to use



HOW TO USE

Install

Run composer require sparky-spa/sparky

Setup config

Set up the settings

Endpoint ajax_uri implementation

It has to support the next URIs

Also, use the function handleHttpRequest() to implement the endpoints correctly

For POST <ajax_uri>/.... requests
For GET <ajax_uri>/{Sparky::NAME_MINI_JS} request

Feel free to use the tool 😉

Back-end

Implement a Component

Let imagine, we have the component

Insert component into a page

The all next variants will work correctly

If you place a component to an additional namespace (e.g. User\ChatCheckerComponent), use the next syntax

Component Actions

Calling order of a component actions

customAction

This is an action, which calls by emit actions.

Return a string to skip the $component->render(); calling. The returned string will be a response onto an ajax request. In the case, the action $component->beforeRendering(); will be skipped too. So, please, call it inside the $component->customAction();, if it needs.

Views

Emit component action

onClick: emit action

It makes request to back-end to an action

onClick: init event

It doesn't make request to back-end but trig an event/action listeners only

Emit action

The time - is delay to an action will emit after the Sparky loading

Init component event

Action on a page/component load

The main different between spa:emit and spa:event is the last one inits an event listeners but not to call the component action on back-end

Bind Component property to HTML field

The component_property_name has to be public property of a component

JavaScript

Sparky load events

It's important to use the load events, because it's a safety way to prevent the error Uncaught ReferenceError: Sparky is not defined

Events list

Inits once per a page load

Inits after a page loading and each time after a component receiving answer on an action request from back-end

Emit component action in JS

The next executions will call a component method

action_name - it's a component method name, which will call. It also is an event_name for listeners data - this is args list of action_name method callback - it will execute after an emit request will be done and before a listener calling

Init component event

To init component event in JS

It also will not call a component method but inits the event listeners

Event/Action Listener in JS

Use the next things to listen an event

event_name - it's a component method name, which was called component_name - a component name of an event.

event_data.response - it will contain HTML body of response if an action (not event) was emitted quietly

Note Do not check a component

Reserved event names

sparky:update_binds

sparky:update_binds - executes on a component property update by a bound tag.

This event pass an updated properties list to a listener

WARNING

Please, do not pass secure data into a Component's public property. It passes to front-end and could be readed in browser


All versions of sparky with dependencies

PHP Build Version
Package Version
Requires php Version >=7.2
opis/closure Version ^3.6
webxid/basic-classes Version ^1.2
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 sparky-spa/sparky contains the following files

Loading the files please wait ....