I think it's time to make documentation available to other programs
(especially editors) in a nice format to work with, hence why not PHP as
the first?
It will be great to have an API for getting documentation. The actual doc's
url structure is really good and I think will be relatively easy to set up
said API (from a software point-of-view at least).

Something like this:
http://php.net/function.file_exists*.json* ->
{
  valid: true,
  type: "function",
  name: "file_exists",
  args: [
    { n: "filename", t: "string",
      //d: "eventually default value",
      //"&": true -> passed as reference
      //v: "X.x" for argument introduced since an X.x version
      doc: "Path to the file or directory.\nOn windows, use
`\/\/computername\/share\/filename` or `\\\\computername\\share\\filename`
to check files on network shares." }
  ],
  ret: {
    type: "bool",
    doc: "Returns **TRUE** if the file or directory specified by filename
exists; FALSE otherwise."
  },
  notes: [
    "This function will return **FALSE** for symlinks pointing to
non-existing files.",
    "The check is done using the real UID/GID instead of the effective
one.",
    "Because PHP's integer type is signed and many platforms use 32bit
integers, some filesystem functions may return unexpected results for files
which are larger than 2GB."
  ],
  warns: [
    "This function returns FALSE for files inaccessible due to safe mode
restrictions. However these files still can be included if they are located
in safe_mode_include_dir."
  ]
}

For an invalid request: {valid: false} will be enough

It will also be nice to have a call for getting all the functions' name for
a given version, in alphabetical order, such as:
http://php.net/5.3/functions.json -> ["array","array_keys", /*, ...*/ ]
So will be easy for editors to cache it and implement an always-updated and
precise autocomplete

Hope you like this idea,
Cheers :)

Reply via email to