This plugin provides support for CakePHP3/4.
You can update to the new version by the same way as the install. You don't have to uninstall the old version.
Enabled
If you just installed Cake3/4 via Composer, you don't have to do anything.
Use when your CakePHP app directory exists in your php project as a subdirectory.
e.g. set app
to Root setting like the following case:
source directory
├── foo
├── bar
└── app
├── README.md
├── bin
├── composer.json
├── composer.lock
├── config
├── index.php
├── logs
├── phpunit.xml.dist
├── plugins
├── src
├── tests
├── tmp
├── vendor
└── webroot
The same as App settings of config/app.php
Support them using .cake
file.
.cake
file.cake
filehome.ctp [Pages]
Component
// in your Controller e.g. SomeController or AppController
public $components = ['Foo', 'My.Bar', 'Bar' => ['className' => 'MyBar'] ];
public initialize() {
$this->loadComponent('Foo');
$this->laodComponent('Bar', ['className' => 'MyBar']);
}
// in your Controller
$this->[Ctrl+Space]
Helper
// in your Controller e.g. SomeController or AppController
public $helpers = ['Foo', 'My.Bar', 'Bar' => ['className' => 'MyBar'] ];
// in your template file e.g. index.ctp
$this->[Ctrl+Space]
Table
// in your Controller e.g. SomeController
$this->loadModel('Users');
// in your Controller
$this->[Ctrl+Space]
Please add @property
to your table class if you want to use like the following:
// e.g. BookmarksTable
/**
* @property \App\Model\Table\TagsTable $Tags
*/
class BookmarksTable extends Table {
}
$this->Bookmarks->Tags->[Ctrl+Space]
Method Parameters
// e.g. path/to/your/template/index.ctp
// file path completion
$this->Html->css('[Ctrl+Space]');
// constants
$this->Html->docType('[Ctrl+Space]');
NOTE Please add a semicolon(;) if you want to use code completions for parameters. Tips: You can add it like the following: Ctrl+;
This feature is not enabled by default. If you want to use it, please set the KeyMap to it.
(Tools > Options > Keymap > Search CakePHP
> CakePHP3/4: Smart Go To > e.g. set Ctrl + Shift + J)
Files related to the current editor are shown when you run this action. e.g. If your current file is a Controller, template, table, entity, testcase, conponent and helper file(s) will be shown.
You can change a list to specific category's one like the following. (Ctrl is a Ctrl or Command key)
NOTE Core files are not shown (e.g. HtmlHelper, AuthComponent, e.t.c.)
You can use the .cake if you want to use the specified directories for Controller, Table, Template, e.t.c.. The file format is the following:
{
"cake": ".\/vendor\/cakephp\/cakephp",
"build_path": {
"entities": [
".\/src\/Model\/Entity\/"
],
"tables": [
".\/src\/Model\/Table\/"
],
"behaviors": [
".\/src\/Model\/Behavior\/"
],
"controllers": [
".\/src\/Controller\/"
],
"components": [
".\/src\/Controller\/Component\/"
],
"templates": [
".\/src\/Template\/"
],
"views": [
".\/src\/View\/"
],
"helpers": [
".\/src\/View\/Helper\/"
],
"consoles": [
".\/src\/Console\/"
],
"shells": [
".\/src\/Shell\/"
],
"tasks": [
".\/src\/Shell\/Task\/"
],
"locales": [
".\/src\/Locale\/"
],
"vendors": [
".\/vendor\/"
],
"plugins": [
".\/plugins\/"
]
}
}
NOTE It is not available in any categories.
You can add some directories(nodes) under the your project tree. Controller, Model, e.t.c. are shown by default. If you want to hide/show them, please change the options.(Tools > Options > PHP > Frameworks and Tools > CakePHP3/4 > Custom nodes)
Right-click a project > CakePHP3/4
All commands will be shown as a list in the command dialog. Then you can run a command with some parameters.
Just run cake server
. If you want to set details, please use Run Configuration
of project properties.
Please run this action after you changed the .cake
file or you updated the version of CakePHP.
Refresh the version number and category paths.
If you have issues, please submit them to GitHub Issues . Please don't create PRs soon.
Apache License, Version 2.0