Download the PHP package webrider/cake-dm without Composer

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

cake-dm

A layer manager for CakePHP applications.

Introduction

As your CakePHP grows, the respective sizes of your Controller, Model and Template folders increase.

Your src/Template/Element folder has probably become a mess too, if you haven't split it in several sub-folders.

New-joiners wonder where to start and, just as you, do not grasp which models relate to another.

An alternative would be to split everything into plugins. But this might not be what you expect from plugins. You would end up with a quantity of plugins added to the real plugins, and a deserted src folder.

Sub-folders! this is the approach proposed by cake-dm. With domain separation in mind, the package proposes to split your MVC structure into layers. And sub-layers.

Requirements

CakePHP >= 3.5

Installation

With composer, run:

Example

Without cake-dm

Assuming the following minimalistic structure for a flight company.

With cake-dm

Cake-dm makes it possible to organize your code as follows:

The advantages are that:

Note that:

Settings

The structure is managed by three components.

Composer

In order to have Cake following the paths without changing the namespaces and intruding in the middleware, you must modify the following in your composer.json file:

Run

after any structural change.

The same applies when introducing domain layers in your plugins.

Controller

In your AppController.php, the relevant paths to the templates should be added as early as in the AppController::initialize().

Cake-dm will know in which layer the request was performed. It will include the template paths of that layer, as well as the App layer. To do so, add:

View

In the view, we have to change the way the elements are getting loaded. In your AppView.php you should overwrite the _getElementFileName() of the Cake\View\View class.

To do that, in AppView.php:

Optional 1

Having multiple directories under one same namespace (see Composer), there is a risk that a developer creates a class in a directory, and a different class with the same name in another directory. This is the price of adding a layer to the MVC.

Neither PHP nor Composer will throw any error or warning if this happens.

In order to avoid this, the following test can be added to your ApplicationTest.php file, to ensure that all your classes are correctly reached by Composer.

Should you absolutely need to have two classes named identically in the src folder, there is nothing the present version of the package can do.

Optional 2

I recommend editing the following line in your config/app.php file under the 'App.paths' entry to:

or your app's namespace, if it is not App.

Should you run into any error messages during the installation, Cake will know the path to the Error template.

This can be eventually removed once the migration is completed. The DomainController sets up that path for you, as described in the section Controller above.

Usage

With the settings done you can call elements of the same layer just as before:

To call elements from another layer, just use the magical @ at the end of the traditional CakePHP notation.

Elements of another layer:

Elements of another sub-layer, e.g. User/Settings:

Elements of another layered plugin:

The notation:

is no longer supported, or at least it can react unpredictably. Instead, organize your structure in a manner, where all reusable templates are located in a domain layer's Element folder. And use the magical @ notation to call elements across domain layers.

Credits

Juan Pablo Ramirez

webrider.de

License

MIT


All versions of cake-dm with dependencies

PHP Build Version
Package Version
Requires php Version >=5.6.0
cakephp/cakephp Version ~3.8
haydenpierce/class-finder Version ^0.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 webrider/cake-dm contains the following files

Loading the files please wait ....