Download the PHP package helsingborg-stad/blade-component-library without Composer

On this page you can find all versions of the php package helsingborg-stad/blade-component-library. 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 blade-component-library

BETA: Blade component library

This is a library containing load functions and library of views with their controllers. Enables swift and precise development of static user interfaces across multiple products. The package is designed to be used standalone or with WordPress as CMS engine.

Important note: This is a view package! Not a single line of CSS or Javascript will be appended. We (will, not complete yet) have a separate package to provide these feature in a syleguide format.

Getting started

Recommended method of usage is with composer. Add the requirement below, to enable a new set of awesome features.

Known issues

Example usage (register a component)

Example usage (render component)

A registered component can be utilized as a component or directive just as in laravel. They do however have the added functionality to load the controller before render to enshure that stuff is formatted and defined.

Render as a directive

Render as a component

Implement replacement views & controllers

This package is designed to be overrided with a theme or plugins own views. Simply add a new path as below. You have an ability to prepend or append the existing search arrays. The path's will be searched chronologically.

Data flow

Base controller components This controller handles all data flow to every component. There are multiple ways of inputting data to a component.

  1. The default configuration of the component. These settings are made in the configuration json in each component folder. All variables used in the controller SHOULD be declared here. This is to avoid undeclared variabe varnings.

  2. By populating the directive (in view file). This should be data that idicates states like isDisabled => true etc. This is the main location of end user customization.

  3. By data manipulation in the controller connected to each component. This data can be in every form, but should focus on translating other input to view data. This file can contain clear-text-classes.

Example:

  1. If the component library is running inside WordPress. There is a additional filter that can be used to externally manipulate the data as a last step before output.

Filter (General): BladeComponentLibrary/Component/Data - Takes $data

Filter (Component specific): BladeComponentLibrary/Component/ComponentName/Data - Takes $data

Filter class (General): BladeComponentLibrary/Component/Class - Takes $class

Filter class (Component specific): BladeComponentLibrary/Component/ComponentName/Class - Takes $class

Class filters extracts the class variable from $data object.

Add a builtin component

The most efficient and proposed way of adding a compning is by a PR to this package. It will then be available for everyone to be used. A internal component requires three different files.

The view

The view sould be as simple as possible, in most cases just a few if-statements. For more advanced solution, please consider to use directive components as childs to a larger component.

Example:

The controller

The controller should handle all logic associated with a component. This file soule purpose is to remove any logic from the view.

Example:

The configuration

A simple configuration of the slug for the component (used as directive & component name). The default parameters and the view name (defaults to the slug name). The configuration should be written in a valid json format. This file must contain the keys "slug", "default" (default parameters) and "view".

Example:

WordPress Compability

Each component will get their respective WordPress filter registered if WordPress core is included before this library. We simply look for the built-in functions called apply_fitlers. The filter will be named as their respective folder location.

For example; Card component located in "./src/Component/Card" will get the filter "BladeComponentLibrary/Component/Card/Data" applied before render. The last part of the slug "Data" can be changed to "Class" to just filter the sub array "classes" of the data object.

A specific filter for each key in the data object will also be created. Fir instance if the data object includes the key 'foo' a filter will be created like this: BladeComponentLibrary/Component/Card/Foo. This will not include the key "data" as it's reserved by above filter.

A generic filter will also be called for the data object called "BladeComponentLibrary/Component/Data". This has the side effect of reserving the data namespace. Therefore you cannot create a component called Data.

View variables

All component views will be allocated with some basic parameters. These are listed below. Everything else added to the $data array will automatically be added as a $var named with the key value.

Variable Description
$class An array of classes that wraps the component.
$compiledClass An string of classes that wraps the component.
$baseClass A string of first class assigned.
$attribute A string of attributes

Built With

Dependencies

Releases

https://github.com/helsingborg-stad/blade-component-library/releases

Authors

License

This project is licensed under the MIT License - see the LICENSE file for details


All versions of blade-component-library with dependencies

PHP Build Version
Package Version
No informations.
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 helsingborg-stad/blade-component-library contains the following files

Loading the files please wait ....