Creating an extension - jasonayre/saruman GitHub Wiki

saruman extension

Command options

Enter extension namespace:

This is the namespace of your extension, E.G. BNW

Enter extension name:

Name of your extension, which will be contained within your extension namespace. E.x. app/code/local/BNW/Blog

Author of extension:

Your name

Version number

Version of your extension, 3 digits separated by periods, e.g. 0.0.1

All of the generators have been abstracted to be able to run standalone, the extension generator just combined all of the generators into one. See the relevant wiki page for the generator you would like more information on.

Example of running the command

  Enter extension namespace: BNW
  Enter extension name: Blog
  Author of extension: Jason Ayre
  Version number (Format - 0.0.1): 0.0.1
  
  Would you like to create a controller?
  1. yes
  2. no
  ?  1
  
  Enter Front Name of controller (will match www.yourmagentoinstall.com/frontname)
  blog
  
  Enter Controller Name (will match www.yourmagentoinstall.com/frontname/controllername)
  post
  
  Enter list of actions for this controller, I.E., index show add  |index show add|
  index show add
  
  Would you like to create controller action views?
  1. yes
  2. no
  ?  1
  
  Create another controller?
  n
  
  Would you like to create an observer?
  1. yes
  2. no
  ?  1
  ?  299
  
  Observe another event?
  n
  
  Would you like to create a model?
  1. yes
  2. no
  ?  1
  
  Enter Name of model:
  Post
  
  Enter Table Name of model:
  blog_posts
  
  Enter Model Fields:
  title:string active:boolean body:text blog_category_id:integer:index
  
  Would you like to create a collection model?
  1. yes
  2. no
  ?  1
  
  Create another model?
  n
  
  Would you like to create a helper?
  1. yes
  2. no
  ?  1

Will create the following files (assuming namespace is BNW and extension name is Blog)

  create  app/code/local/BNW/Blog/controllers
  create  app/design/frontend/base/default/layout/blog.xml
  create  app/code/local/BNW/Blog/controllers/PostController.php
  create  app/design/frontend/base/default/template/blog/post
  create  app/code/local/BNW/Blog/Block
  create  app/code/local/BNW/Blog/Block/Post.php
  create  app/design/frontend/base/default/template/blog/post/index.phtml
  create  app/design/frontend/base/default/template/blog/post/show.phtml
  create  app/design/frontend/base/default/template/blog/post/add.phtml