Download the PHP package canvass/canvass-core without Composer

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

Canvass Core

A Form-Building library for PHP.

Installation

You can install this package with composer:

Concepts and Terms

There are several concepts to understand to fully use Canvass.

Form

The purpose of Canvass is to be able to visually create an html <form>. The form record handles the <form> element and a little bit more. Inside the form are fields.

Field

A field represents most of the elements within a form. It includes more-obvious elements like <input>, <select> and <fieldset>, but it also includes other elements such as dividers (<hr>) and columns.

NestedField

Some fields can only nest inside other fields (ex. <option> nests under a <select>). Other field types can be both top-level and nested fields (just about any field can nest inside a column).

FieldData

The form fields database table has columns for such data points as label, html id, html classes, name and value attributes, etc.... Not every field type uses all of the fields, but the main columns represent the typical data needed for a field.

Attributes

But several fields have extra attributes that can be used (ex. <input type="number"> can have extra attributes like required, min, max and step). These type of attributes are stored as json in the attributes column.

FieldType

Each field has a specific type (just referred to as type) and a general type. The general type tends to correspond to the appropriate html element that would respresent the field (ex. a text field's type is "text" and its general type is "input"). Many of the fields have the same specific and general type.

Action

Instead of controllers to add/manipulate form and field data, Canvass uses actions that can be integrated into web frameworks as needed. There are actions for listing (Index), adding (Create/Store), updating (Edit/Update), resorting (Move Up/Down), as well as for deleting and validating.

Forge

Canvass is meant to be flexible and able to be integrated into any framework. But that requires abstractions and deferring of details. Instead of sprinkling the library with deferring details, most of it is located in the Forge class. The Forge class allows the developer to set concrete implementations of the interfaces that Canvass uses.

Below is example code for using Canvass\Forge in the Laravel framework:

Canvass then takes advantage of the concrete implementations by calling methods on Forge:

Validation

A form's data is only as good as its validation, so Canvass has several mechanisms for creating validation rules, some used in building the forms/fields and some for handling form submissions.

Please note: you must supply a validation library in order to use Canvass.

Validate

The Validate interface is the way that Canvass can use the dev-supplied validation library to validate submitted data.

ValidationMap

The validation rules that Canvass uses might not match up with your framework's/library's validation library. Implementing the ValidationMap allows you to convert Canvass rules to whatever format is necessary for validation.

ValidateFieldAction

The ValidateFieldAction interface is used on the form building side to ensure that the specific field type's data is valid before database insertion.

CanvassPaint

Canvass Core is agnostic when it comes to actually creating the form html since it doesn't know what the developer uses for html rendering. A developer can use CanvassPaint to create the html by supplying an appropriate renderer.

There are two Paint libraries currently supported by the Canvass team: CanvassPaint\Blade and CanvassPaint\Twig.

But new Paint libraries can be made by implementing and using the RenderFunction interface and using it in \CanvassPaint\Action\RenderForm. The Blade and Twig libraries can help guide the implementer on how to set up the various field views.

Extending Canvass

You can add new Field types to extend Canvass.

Adding a new Field

Example Extension

Let's build a select field, DatabaseSelect, with a set of options coming from a database connection. The database has a simple table called, retrievables, with id, owner_id, and name columns.

We'll add three files to a folder labelled as DatabaseSelect:

The three files might look like this:

FieldData.php

If we don't create a FieldData class, Canvass will fall back to the \Canvass\Support\FieldData class. But in this case, we need to specify extra logic for retrieving data using the FieldDataRetrievable interface.

FieldType.php

The field type class allows us to specify what should be used as the field's type and general type. The general type should match up with an existing general type in order to render.

Validation.php

The validate class ensures that the field has the correct data by generating the proper validation rules that your framework/library will use to validate the supplied data.


All versions of canvass-core with dependencies

PHP Build Version
Package Version
Requires promo-code/web-anvil Version ^0.4
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 canvass/canvass-core contains the following files

Loading the files please wait ....