CakePHP 框架的工具

euromark a3097d1c4c tests for logable behavior 12 年之前
Config 3cf2d9b0c6 fix whitespace coding standard errors 12 年之前
Console bc54efd7b6 Fix lineLength and mimType for EmailLib/CakeEmail 12 年之前
Controller afcd436af1 dont run if not an array 12 年之前
Lib e4cdadf389 documentation and cleanup 12 年之前
Locale 560d168a8b qlogin and fixes 14 年之前
Model 9de0dfcfe6 test case to prove soft delete can return true 12 年之前
Test a3097d1c4c tests for logable behavior 12 年之前
TestSuite cd0f1eec24 Move some methods out of TextLib to clean up. 13 年之前
Vendor 83a5741614 NumberTextLib and Soros vendor package 13 年之前
View 8d7537c7e0 CurrencyLib 12 年之前
webroot bbb8cacfa2 doc update 14 年之前
.travis.yml 6aeead09ed simplify travis 12 年之前
CONTRIBUTING.md c4ac7a3318 contributing file 12 年之前
README.md c65828f25f readme 12 年之前
USAGE 5c8f26c714 usage update 13 年之前
composer.json daae04ad12 adding composer.json 13 年之前

README.md

CakePHP Tools Plugin

A Cake2.x Plugin containing several useful tools that can be used in many projects.

Please note: New functionality has been tested against cake2.3 only. Please upgrade if possible.

How to include

Installing the Plugin is pretty much as with every other CakePHP Plugin.

  • Put the files in APP/Plugin/Tools
  • Make sure you have CakePlugin::load('Tools') or CakePlugin::loadAll() in your bootstrap

Tip: You can also use packagist now @ https://packagist.org/packages/dereuromark/tools-cakephp

That's it. It should be up and running.

The basics

Include the Tools bootstrap file in your APP/Config/bootstrap.php with

App::import('Lib', 'Tools.Bootstrap/MyBootstrap');

You cannot use App::uses because this file does not contain a class and needs to be included right away (not lazy loaded).

MyModel can be extended to use more powerful validation and other improvements:

App::uses('MyModel', 'Tools.Model');

class AppModel extends MyModel {
}

MyController can be extended for DRY improvements and to fix some common bugs:

App::uses('MyController', 'Tools.Controller');

class MyController extends MyController {
}

MyHelper can be extended and used this way:

App::uses('MyHelper', 'Tools.View/Helper');

class AppHelper extends MyHelper {
}

The test suite improvements can be used via:

App::uses('MyCakeTestCase', 'Tools.TestSuite');

class SomeClassTest extends MyCakeTestCase {
}

To run any of the console commands (replace [ShellName] and [command]!):

cake Tools.[ShellName] [command]

The models, behaviors, helpers, libs and other classes are used the same way prefixing them with the plugin name:

App::uses('GooglLib', 'Tools.Lib');
App::uses('TimeLib', 'Tools.Utility');
App::uses('GeocoderBehavior', 'Tools.Model/Behavior');
...

Tip: For how to use them, try to find some information in the test cases. Usage for some larger modules: https://github.com/dereuromark/tools/blob/master/USAGE

Disclaimer

Use at your own risk. Please provide any fixes or enhancements via issue or better pull request. Some classes are still from 1.2 (and are merely upgraded to 2.x) and might still need some serious refactoring. If you are able to help on that one, that would be awesome.

Status

Build Status

Branching strategy

The master branch is the currently active and maintained one and works with the current 2.x stable version. Older versions might be found in their respective branches (1.3, 2.0, 2.3, ...). Please provide PRs mainly against master branch then.

For details on how to contribute please read the CONTRIBUTING page.

Recent changes (possibly BC breaking)

  • 2013-02 Removed PasswordChangeBehavior in favor of its new name Passwordable.
  • 2013-02-25 Removed deprecated bootstrap functions and moved DebugTab functionality into Bootstrap namespace (you need to now manually include it if needed).