junichi11 / cakephp3-netbeans

CakePHP3/4 support in NetBeans
Apache License 2.0
46 stars 10 forks source link
cakephp3 cakephp4 netbeans-plugin

NetBeans CakePHP3/4 Plugin

This plugin provides support for CakePHP3/4.

Requirements

Downloads

How To Install

Via NetBeans Plugin Portal Update Center

Use downloaded nbms

How To Update

You can update to the new version by the same way as the install. You don't have to uninstall the old version.

How To Enable

Use Your Custom Directory Structure

If you just installed Cake3/4 via Composer, you don't have to do anything.

Root

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 Others

The same as App settings of config/app.php

Templates, plugins, locales, e.t.c.

Support them using .cake file.

Features

Code Completion

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+;

Smart Go To

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.)

Support for a .cake file

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.

Custom nodes

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)

Actions

Right-click a project > CakePHP3/4

Run Command

All commands will be shown as a list in the command dialog. Then you can run a command with some parameters.

Run server

Just run cake server. If you want to set details, please use Run Configuration of project properties.

Refresh

Please run this action after you changed the .cake file or you updated the version of CakePHP. Refresh the version number and category paths.

Donation

Issues

If you have issues, please submit them to GitHub Issues . Please don't create PRs soon.

License

Apache License, Version 2.0