sfCodeViewPlugin - 1.1.1

Interactively read your project's code and all Symfony classes, to learn or for reference.

You are currently browsing
the website for symfony 1

Visit the Symfony2 website

« Back to the Plugins Home


Forgot your password?
Create an account



advanced search
Information Readme Releases Changelog Contribute
Show source

sfCodeView plugin

Learn coding by reading code!

This plugin makes it easy to read your the code of any class in your project, reflect on the API of the symfony core or learn about the inner workings of a Symfony.

WARNING: please make sure you never use this plugin in a production environment. Publishing your code can lead to severe security risks!!


sfCodeView is a symfony plugin that extends the debug bar with an option to interactively read the source code of your project. The plugin can optionally use the sfJQueryReloaded plugin. If this plugin is used the browser will use AJAX calls which will enable a smoother experience.


  • Install the plugin

    > php symfony plugin:install sfCodeViewPlugin  # for symfony 1.2
  • Publish the plugin assets

    > php symfony plugin:publish-assets
  • Clear the cache

    > php symfony cc
  • Enable the sfCodeView module in settings.yml:

        enabled_modules:        [default, sfCodeView]
  • To enable ajax interaction, jquery is needed. Install either a jQuery plugin (like sfJqueryReloadedPlugin) or add jquery from Google cdn in your view.yml:

        - http://ajax.googleapis.com/ajax/libs/jquery/1.3./jquery.min.js


In dev mode the debug toolbar will be extended with a little input box. Type the name of a class in your project in there and the sfCodeView plugin will show you the code. That's all!


The following options are available (all in app.yml), all options displayed are the defaults, specified in the plugins app.yml:

      - '/sfCodeViewPlugin/css/sfCodeViewPlugin.css'
      - '/sfCodeViewPlugin/js/sfCodeViewPlugin.js'
    recurse_vendor_dirs:    false
    cache_in_user_session:  sfCodeViewPlugin_cache_content
  • You can add/override the javascripts / stylesheets included in this plugin by overriding the plugin's app.yml. This allows you to easily give your transformed forms custom styles

  • recurse_vendor_dirs specifies if you also want read the classes inside vendor directories in your project. Setting this to true can take a lot of time to load, for instance when you have a full 'Zend' library in your /lib/vendor/Zend.

  • for speeding up the script, specify a key at cache_in_user_session, all classes will only loaded at the first request of the current session/user and will then be stored in the session using the specified key. If you want to reload the classes, close your browser and reload in a new one. Use 'false' to disable the cache.

TODO / Ideas

  • integrate links to the symfony core test files, as they provide a lot of information about how to use the classes


2009-12-08 | 1.1.1 stable

  • added cache_in_user_session setting to app.yml
  • added recurse_vendor_dirs setting to app.yml
  • changed package.xml to accept version of history between 1.3.0 and 2.0.0
  • fixed loading of user classes, now exclude vendor directory
  • fixed CSS

2009-12-03 | 1.1 stable

  • made the plugin sf 1.3 and 1.4 compatible
  • added method docblock as a title for class methods
  • tested in firefox, chrome and ie, works ok in chrome&firefox, ie works but is not as nice as in chrome or firefox

2009-05-06 | 1.0 stable

  • weett: initial import