Table Of Contents

Next topic

Reference

This Page

PHP Domain

author:Mark Story <mark at mark-story.com>

About

A domain for sphinx >= 1.0 that provides language support for PHP.

PHP Domain supports following objects:

  • Global variable
  • Global function
  • Constant
  • Namespace
    • Function
    • Class
  • Class
    • Class constant
    • Instance methods
    • Static methods
    • Properties

Note

This domain expresses methods and attribute names like this:

Class::method_name
Class::$attribute_name

You address classes/functions in namespaces using \ syntax as you would in PHP:

Package\Subpackage\Class

Quick Sample

This is source:

.. php:class:: DateTime

  Datetime class

  .. php:method:: setDate($year, $month, $day)

      Set the date.

      :param int $year: The year.
      :param int $month: The month.
      :param int $day: The day.
      :returns: Either false on failure, or the datetime object for method chaining.


  .. php:method:: setTime($hour, $minute[, $second])

      Set the time.

      :param int $hour: The hour
      :param int $minute: The minute
      :param int $second: The second
      :returns: Either false on failure, or the datetime object for method chaining.

  .. php:const:: ATOM

      Y-m-d\TH:i:sP

Result

class DateTime

Datetime class

setDate($year, $month, $day)

Set the date.

Parameters:
  • $year (int) – The year.
  • $month (int) – The month.
  • $day (int) – The day.
Returns:

Either false on failure, or the DateTime object for method chaining.

setTime($hour, $minute[, $second])

Set the time.

Parameters:
  • $hour (int) – The hour
  • $minute (int) – The minute
  • $second (int) – The second
Returns:

Either false on failure, or the DateTime object for method chaining.

constant ATOM

Y-m-dTH:i:sP

Cross referencing

From other place, you can create cross reference like that:

You can modify a DateTime's date using :php:meth:`DateTime::setDate`.

Result

You can modify a DateTime’s date using DateTime::setDate.

Install

You can install the phpdomain using easy_install:

easy_install -U sphinxcontrib-phpdomain

ChangeLog

0.1.4

  • Added support for traits.

0.1.3

  • Fixed issues with global functions getting nested inside classes that preceded them.
  • Fixed static methods being omitted from the index.
  • Interface support added (thanks heavenshell).

0.1.2

  • Made it possible to not require class properties to be nested under the class definition.
  • Added .. php:staticmethod: to solve ambiguity in method naming.
  • Added prefixes for a number of things, and removed classname as a prefix for indented class constants.

0.1.1

  • Fixed issues with constant documentation.

0.1.0

  • Initial release.