Download the PHP package brightnucleus/shortcodes without Composer

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

Bright Nucleus Shortcodes Component

Config-driven WordPress shortcodes.

Scrutinizer Code Quality Code Coverage Build Status Codacy Badge Code Climate

Latest Stable Version Total Downloads Latest Unstable Version License

This is a WordPress shortcodes component that lets you define shortcodes through a config file, complete with dependencies, localization and Shortcake UI.

Table Of Contents

Installation

The best way to use this component is through Composer:

Basic Usage

To use this component, you'll need to:

  1. instantiate the ShortcodeManager class;
  2. inject an object implementing the BrightNucleus\Config\ConfigInterface through its constructor;
  3. call its register() method.

Configuration Schema

Registering a basic shortcode

For the following example, we'll register a new shortcode that provides a simple [button] shortcode. We want the shortcode to be configurable through Shortcake.

Configuration File

First, we need to define the shortcode through a configuration file.

Template file

Then, we'll need to write a template that can be rendered by the shortcode.

Initialization

Finally, we'll need to initialize the ShortcodeManager with the configuration file, and let it register() its shortcodes.

Using Custom Classes

The actual implementations to be used for the following interfaces can be changed through the Config files:

The Config files accepts a key for overriding each of these. You can pass either a fully qualified class name or a callable that acts as a factory.

When using a callable, the arguments that are passed to that callable are the same as the constructor gets for the default implementation of each of these.

Using Relative Views

The underlying implementation uses the brightnucleus/view package to render the actual views for each shortcode. The default behavior already deals with absolute paths and can render any type of views that the Views engine being used can handle. If no specific instance of a ViewBuilder was injected, then the ShortcodeManager will rely on the one provided by the Views Facade.

To adapt the locations that the view engine looks in for relative view URIs or to configure the available rendering engines, you can either adapt the instance centrally available through the Facade, or, preferably, inject your own custom ViewBuilder instance into the ShortcodeManager as the third constructor argument.

Once you've added one or more locations in this way, you can use relative URIs in your config file. They do not even need to contain the extension, as long as that can be inferred by the engines that are known to the view builder. This makes overriding the views later on very flexible, in that you can not only override shortcode markup in your theme that was defined in your plugin, but you can also use a different engine than was originally use.

Refer to the brightnucleus/view documentation on how to go about configuring a ViewBuilder instance.

Adding Additional Context

The default implementation allows you to add_context() to the shortcode, which will then also be passed to the view to be rendered.

This can be with a dependency injector, for example, to further prepare a shortcode with additional data after it has already been instantiated.

Using An External DI

To use an external dependency injector with the default Shortcode implementation, you can pass an object to the Shortcode::with_injector() method that provides a make( $class, $args ) method.

You might need to provide an adapter to modify the $args argument as needed.

Contributing

All feedback / bug reports / pull requests are welcome.

License

Copyright (c) 2016 Alain Schlesser, Bright Nucleus

This code is licensed under the MIT License.


All versions of shortcodes with dependencies

PHP Build Version
Package Version
Requires brightnucleus/config Version >=0.2
brightnucleus/exceptions Version >=0.2
brightnucleus/dependencies Version >=0.2
brightnucleus/contracts Version >=0.1
gamajo/template-loader Version >=1.2
brightnucleus/invoker Version >=0.2.0
brightnucleus/view Version >=0.4.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 brightnucleus/shortcodes contains the following files

Loading the files please wait ....