Download the PHP package / without Composer

On this page you can find all versions of the php package /. 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?
/
Rate from 1 - 5
Rated 5.00 based on 2 reviews

Informations about the package

Controller

WordPress package to enable a controller when using Blade with Sage 9 (Please note, Sage 10 uses Composers and not this package.)


Installation

Composer:

Sage ships with Controller. However, should you need to install, browse into the Sage theme directory and run;

Upgrading to 2.x.x:

Please note that versions 2.x.x are newer releases than 9.x.x-beta. The 9 was used to match Sage 9 versioning at the time.

Controller 2.x.x uses PSR4 autoloading to load Controller classes. This is considered best practice. You will need to update the following files from 9.0.0-beta versions.

Folder controllers/ changes to Controllers/, class file names changes to camelcase App.php and FrontPage.php. Controller namespaces changes to namespace App\Controllers;

Requirements:

Setup

By default Controller uses namespace Controllers.

Controller takes advantage of PSR-4 autoloading. To change the namespace, use the filter below within functions.php

Usage

Overview:

The above may sound complicated on first read, so let's take a look at some examples to see how simple Controller is to use.

Basic Controller;

The following example will expose $images to resources/views/single.blade.php

app/Controllers/Single.php

resources/views/single.blade.php

Using Functions;

You can use static methods to run a function from within your view.

This is useful if you are within the loop and want to return data for each post item.

app/Controllers/Archive.php

resources/views/archive.php

Using Components;

You can also create reusable components and include them in any Controller class using PHP traits.

app/Controllers/Partials/Images.php

You can now include the Images trait into any view to pass on variable $images;

app/Controllers/Single.php

Inheriting the Tree/Hierarchy;

By default, each Controller overrides its template hierarchy depending on the specificity of the Controller (the same way WordPress templates work).

You can inherit the data from less specific Controllers in the hierarchy by implementing the Tree.

For example, the following app/Controllers/Single.php example will inherit methods from app/Controllers/Singular.php;

app/Controllers/Single.php

If you prefer you can also do this;

You can override a app/Controllers/Singular.php method by declaring the same method name in app/Controllers/Single.php;

Creating Global Properties;

Methods created in app/Controllers/App.php will be inherited by all views and can not be disabled as resources/views/layouts/app.php extends all views.

app/Controllers/App.php

Advanced Custom Fields Module;

Controller has an useful Advanced Custom Fields helper module to automate passing on fields.

The automated fields will use the variable names from Advanced Custom Fields and pass them onto the view. Controller also passes on options values by default.

Clone fields will return the value of each the fields in a separate variable, unless the Prefix Field Names option is enabled in which case the the cloned fields will be returned in an object with the field name given to the clone field.

The values are returned as objects, however you can disable this to keep them as arrays.

Template Override Option;

You should only use overrides in edge-case scenarios. Sticking to the WordPress hierarchy is recommended usage. However, one edge-case is the 404 template.

In your Blade view, you would have 404.blade.php as it begins with a number. In this case, you could rename your Controller class FourZeroFour.php and use parameter $template = '404';

Lifecycles;

Controller Classes come with two lifecycle hooks for greater control.

Disable Option;

Blade Debugger;

In your Blade views, resources/views, you can use the following to assist with debugging;

Blade Coder;

In your Blade views, resources/views, you can use the following to assist with jump-starting coding;

To wrap the code in if statements, use @codeif

Support

Updates


All versions of with dependencies

PHP Build Version
Package Version
Requires php Version >=5.6.0
brain/hierarchy Version ^2.4.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 / contains the following files

Loading the files please wait ....