Skip to content
| Marketplace
Sign in
Visual Studio Code>Snippets>CakePHP SnippetsNew to Visual Studio Code? Get it now.
CakePHP Snippets

CakePHP Snippets

马克菌

|
15,502 installs
| (1) | Free
CakePHP Snippets
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info


logo
Cake PHP snippets for VS Code

Visual Studio Code snippets code example for Cake PHP 2 & 3

Visual Studio Marketplace Version License Github

Demo

Subheader Demo
Subheader Demo

Controller

Snippet Prefix Snippet
var_dump vd var_dump();
debug db debug();
die(json_encode()) dj die(json_encode());
loadModel lm $this->loadModel('');
find find $this->Model->find('all');
data data $this->request->data
save save $this->Model->save()
pr pr pr();exit;
set set $this->set();
allow allow $this->Auth->allow()
authenticate authenticate $this->Auth->authenticate()
deny deny $this->Auth->deny()
loggedIn loggedIn $this->Auth->loggedIn()
login login $this->Auth->login()
logout logout $this->Auth->logout()
mapActions mapActions $this->Auth->mapActions()
redirectUrl redirectUrl $this->Auth->redirectUrl()
flash flash $this->Session->flash();
check check $this->Session->check();
delete delete $this->Session->delete();
destroy destroy $this->Session->destroy();
setFlash setFlash $this->Session->setFlash();
write write $this->Session->write();
read read $this->Session->read();
read read $this->Session->read();
conditions conditions 'conditions' => array('Model.id =>$id)
order order 'order' => array('Model.id' => 'ASC')
contain conatain 'contain' => array('Model')
url-array url array('controller' => '', 'action' => '')
$this->request request $this->request
$this->redirect redirect $this->redirect
$this->request->params params $this->request->$params
$this->request->query query $this->request->query

View

Snippet Prefix Snippet
create create $this->Form->create();
end end $this->Form->end();
input input $this->Form->input();
inputs inputs $this->Form->inputs();
label label $this->Form->label();
text text $this->Form->text();
password password $this->Form->password();
hidden hidden $this->Form->hidden();
textarea textarea $this->Form->textarea();
radio radio $this->Form->radio();
select select $this->Form->select();
file file $this->Form->file();
button button $this->Form->button();
postButton postButton $this->Form->postButton();
postLink postLink $this->Form->postLink();
year year $this->Form->year();
month month $this->Form->month();
day day $this->Form->day();
hour hour $this->Form->hour();
meridian meridian $this->Form->meridian();
error error $this->Form->error();
isFieldError isFieldError $this->Form->isFieldError();
unlockField unlockField $this->Form->unlockField();
secure secure $this->Form->secure();
submit submit $this->Form->submit();
element element $this->element();
link clink $this->Html->link();

View(HTML)

Snippet Prefix Snippet
create create Form->create(); ?>
end end Form->end(); ?>
input input Form->input(); ?>
inputs inputs Form->inputs(); ?>
label label Form->label(); ?>
text text Form->text(); ?>
password password Form->password(); ?>
hidden hidden Form->hidden(); ?>
textarea textarea Form->textarea(); ?>
radio radio Form->radio(); ?>
select select Form->select(); ?>
file file Form->file(); ?>
button button Form->button(); ?>
postButton postButton Form->postButton(); ?>
postLink postLink Form->postLink(); ?>
year year Form->year(); ?>
month month Form->month(); ?>
day day Form->day(); ?>
hour hour Form->hour(); ?>
meridian meridian Form->meridian(); ?>
error error Form->error(); ?>
isFieldError isFieldError Form->isFieldError(); ?>
unlockField unlockField Form->unlockField(); ?>
secure secure Form->secure(); ?>
submit submit Form->submit(); ?>
element element element(); ?>
link clink Html->link(); ?>

Model

Snippet Prefix Snippet
belongsTo bt public $belongsTo = array(
  'classname' => array(
   'foreignKey' =>     'foreign_key',
    'className' =>       'className'
));
hasMany hm public $hasMany = array(
'className' => array(
'className' => 'className',
'dependent' => true
));
hasAndBelongsToMany habtm public $hasAndBelongsToMany = array(
'className' => array(
'className' => 'className',
'joinTable' => 'join_table',
'foreignKey' =>
foreign_key',
'associationForeignKey' => ,
association_foreign_key',
));
validate validate $this->element('file');
validation validation public validate = array(
'field' => array(
'rule' => 'ruleName',
'message' =>
message'
));
actsAs act public $actsAs = array( );
App::uses uses App::uses('AppModel', 'Model');

Base on vicocamacho/cakephp-snippets and [openam/SublimeCakePHP](https://github.com/BubbleKID/vscode-cakephp-snippets/blob/master/ https://github.com/openam/SublimeCakePHP)

License

Please read License for more information

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft