Download the PHP package webchemistry/stimulus without Composer

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

Installation

composer require webchemistry/stimulus

Set up extractor and generators

First, set up extractor and generator. Namespaced identifiers also supported.

Code with comments (copy-paste code is below):

copy-paste code:

How files are generated

Class JavascriptSourceExtractor uses javascript comments for generating. Each controller must be annotated with @controller, actions with @action and their parameters with @param, values, classes and targets with @property.

my_controller.js

This PHP class is generated:

By default, each property is required, if we want to make optional we have several ways:

  1. add ? to the end of property name: @property {String} stringValue?
  2. add { optional } to the 3rd section (options) of property: @property {String} stringValue {optional}
  3. add hasser @property {Boolean} hasStringValue

Javascript types and PHP types

webchemisty/stimulus introduces stricter environment for writting application. Nowadays, everyone use static analysis (at least they should) so correct types are crucial.

Library converts javascript types in the following way:

Number => int|float narrowing is achieved by options (3rd section) { number: int } \ Array and Object => mixed[] \ Boolean => bool \ String => string \ other => mixed

Arrays: \ String[] => string[] \ Number[] => array<int|float> narrowing: { number: float } \ Bool[] => bool[] \ other => mixed[]

Custom types

Sometimes we need overriding comment types @param ... and types method(... $type) fot this there is options type and commentType e.g. { type: mixed, commentType: "array<string, resource>" }

Action parameters

Stimulus 3 introduced parameters for actions. For generating just use intersection type or just object type.

Usage in PHP

Usage in Latte

Controller as service

Sometimes we want to inject other services:


All versions of stimulus with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0
nette/php-generator Version ^3.5.0 || ^4.0.0
doctrine/lexer Version ^1.2
nette/finder Version ^2.5 || ^3.0
utilitte/php Version ^1.5
webchemistry/simple-json Version ^1.0
typertion/php Version ^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 webchemistry/stimulus contains the following files

Loading the files please wait ....