Download the PHP package tiny-pixel/blocks without Composer

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

tiny-pixel/blocks

Provides a backbone for building modular blocks with Blade templating support.

This framework is under active development.

What this is

What this is not

Getting started

Use composer to install the package to your project:

Usage

See the demo directory in the repo for an example implementation.

File structure:

Somewhere in your plugin, hook into the tinypixel/blocks/loaded action.

It passes you an instance of the library. Call main to kick everything off. You must pass the path to your config directory to main.

In config/app.php, you only really need to do two things:

  1. Add your blocks to the classes in the blocks key:

  2. Change the project.domain key to match the namespace of your blocks. Not the PHP namespace, but the block namespace used in register_block_type.

You can modify the other settings as you see fit. They are largely self explanatory and control where caches are stored, where compiled assets are being stored, etc. One day this might even be documented!

Block definitions

By default, the library will look for block classes in src/.

This classname should match the name of the block without the block namespace. For example, for a foo/demo namespace we will register the class as Demo. The namespace is set in config.project.domain, as mentioned above.

Use the setupAssets method to register your block scripts and styles.

In addition to the ones below you can use $this->addPublicScript and $this->addPublicStyle to register frontend scripts and styles.

Last step (other than actually writing the block JS, good luck!) is to implement the template. The default template path is resources/views. The block template should be named block.blade.php. It should be located in a directory named after the block name.

Any block attributes are available in the template as $attr. These attributes are passed to the block as an object.

In addition to the $attr object, you also have access to $content, which is a string of the block content. You also have access to a $id and $className variable, for convenience.

The $id is a unique identifier for the block. You can use it for dynamically applying styles to the block, or calling JS functions.

The $className is the class name of the block. This is based on the block name and follows the following naming convetion: wp-block-{namespace}-{name}.

Author notes

© 2019 Tiny Pixel Collective

Licensed MIT.


All versions of blocks with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1
composer/installers Version v2
illuminate/collections Version ^8.61
eftec/bladeone Version ^3.24
php-di/php-di Version ^6.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 tiny-pixel/blocks contains the following files

Loading the files please wait ....