loadsys/cakephp-loadsys-theme

CakePHP 3.x bake generation theme that matches Loadsys' code sniffer standards.

Installs: 12 247

Dependents: 0

Suggesters: 0

Security: 0

Stars: 2

Watchers: 12

Forks: 0

Open Issues: 13

Type:cakephp-plugin

1.1.0 2016-06-20 02:22 UTC

This package is not auto-updated.

Last update: 2024-04-13 14:56:05 UTC


README

Latest Version Software License Total Downloads

A CakePHP 3.x bake generation theme that matches Loadsys' code sniffer standards. It's designed to dovetail with our CakePHP App Skeleton.

Requirements

  • CakePHP 3.x

Installation

$ composer require loadsys/cakephp-loadsys-theme:~1.0

This plugin includes Bake in its own composer dependencies, so when using this theme you do not need to include it separately in your projects.

Usage

  • Add this plugin to your application by adding this line to your bootstrap.php
CakePlugin::load('LoadsysTheme', ['bootstrap' => true, 'routes' => false]);
  • To use when baking, use the CLI option --theme LoadsysTheme like so
$ ./vendor/bin/cake bake all --theme LoadsysTheme name-of-thing

Notable Changes

Tabs instead of spaces

Loadsys has chosen to ignore the requirement of PSR-2 to use spaces for indenting. We've found tabs to be more convenient, and we're keeping them. If you disagree, that's fine -- this plugin isn't going to be much use to you.

K&R/1TBS Braces

We're also sticking to K&R style braces for everything.

	public function foo() {
		echo 'hi';
	}

AppTable

The core team believes that using AppController and AppView continues to provide significant value to the framework (thread), but does not feel that hold true for AppTable (or AppEntity). We disagree.

Table classes baked by this plugin extend from a parent [App]Table class (conveniently still called Table thanks to PHP namespaces.) The Table class it depends upon is provided from the Loadsys CakePHP Skeleton. As in Cake 2, it's safe to completely ignore this file, provided it is at least present in your app. If you need a Table class baked in which you wish to change this, you must either bake using Cake's default theme or modify the classes after baking them.

Additionally, because our table.ctp template assumes that our Skeleton's base Table class will be used, we suppress certain parts of the table baking process. The [App]Table class sets up the primary key, adds the Timestamp and CreatorModifier behaviors, defines two default associations to Creators and Modifiers in the Users table, and suppresses validation for the 5 related fields. It would therefore be redundant and defeat the purpose of the based Table class to bake tables that repeated these steps, so they are skipped.

Contributing

Code of Conduct

This project has adopted the Contributor Covenant as its code of conduct. All contributors are expected to adhere to this code. Translations are available.

Reporting Issues

Please use GitHub Isuses for listing any known defects or issues.

Development

When developing this plugin, please fork and issue a PR for any new development.

Running Tests

  • vendor/bin/phpunit --coverage-html=tmp/coverage/
  • vendor/bin/phpcs

License

MIT

Copyright

Loadsys Web Strategies 2016