Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7091949
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T08:15:06+00:00 2026-05-28T08:15:06+00:00

Is there a way to insert PHPDoc in VIM using a command or key

  • 0

Is there a way to insert PHPDoc in VIM using a command or key combination?

For example, I have a class:

class MyClass
{

  public function __construct() { }
  public function __destruct() { }

  /* command here to insert PHP doc */
  public function abc() { }

}

I would like to insert something like:

/**
* method() 
*
* description
*
* @access   
* @author    
* @param    type    $varname    description
* @return   type    description
* @copyright
* @version
*/

And then I can full out the rest manually. Thank you

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T08:15:06+00:00Added an answer on May 28, 2026 at 8:15 am

    This can be done pretty effectively with the lightweight phpDocumentor plugin.

    Edit Here’s a modified version with more recent development.

    Edit Here’s version 2 of the phpDocumentor plugin. It is more recent than the above two links.

    Install the plugin into your $VIMFILES/plugin directory and add this to your .vimrc:

    " PHP documenter script bound to Control-P
    autocmd FileType php inoremap <C-p> <ESC>:call PhpDocSingle()<CR>i
    autocmd FileType php nnoremap <C-p> :call PhpDocSingle()<CR>
    autocmd FileType php vnoremap <C-p> :call PhpDocRange()<CR> 
    

    The above binds phpDocumentor to Ctrlp in insert, normal, and visual modes. Place your cursor on a class, function, or variable definition, press Ctrlp, and the plugin will attempt to form a doc block based on the definition.

    Example function doc block:

    /**
     * testDocBlock 
     * 
     * @param mixed $param1 
     * @param mixed $param2 
     * @static
     * @access public
     * @return boolean
     */
    public static function testDocBlock($param1, $param2) {
      // Pressed Ctl-p while cursor was on the function definition line above...
    }
    

    Example class doc block

    Copyright, version, author, etc are included by default in a class doc block. You can modify the plugin to include your own default values for these:

    /**
     * TestClass  
     * 
     * @package 
     * @version $id$
     * @copyright 
     * @author Michael <me@exmaple.com> 
     * @license 
     */
    class TestClass {
    
    }
    

    Full abstract class example:

    <?php
    /**
     * TestClass 
     * 
     * @abstract
     * @package 
     * @version $id$
     * @copyright 
     * @author Michael <email@example.com>
     * @license 
     */
    abstract class TestClass {
      /**
       * publicProp  
       * 
       * @var string
       * @access public
       */
      public $publicProp;
      /**
       * privateProp  
       * 
       * @var string
       * @access private
       */
      private $privateProp;
    
      /**
       * testDocBlock  
       * 
       * @param string $param1 
       * @param string $param2 
       * @static
       * @access public
       * @return boolean
       */
      public static function testDocBlock($param1, $param2) {
        // code here...
      }
    }
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

is there a way to insert an entity without using the SubmitChanges() function of
Using SAS's Proc SQL, is there a way to insert records from a SAS
Is there a way to insert a row using ADO.Net without filling the dataset
Without using a while or forloop, is there a way to insert a record
Using aspnet 3.5, c# - Is there a way to insert Html into a
Is there a way to insert data using LinqPad and the entity framework? You
I have two questions: Is there a way to insert a ThreadPool functoin that
Is there any way to insert an NSLocalizedString in interface builder. For example set
Is there a way to insert a string in a string constant/variable that contains
Is there a way to INSERT multiple records rather than one at a time?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.