Download the PHP package linusshops/magicdoc without Composer

On this page you can find all versions of the php package linusshops/magicdoc. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package magicdoc

magicdoc

Magicdoc automatically generates @method documentation for known magic method options from a JSON document. The top level elements of the JSON file will be scanned, and used to create @method lines in the destination class file.

Impetus

When connecting to an external api, it returned a JSON document with many properties. As the api had many endpoints, and many possible returnable properties, it would not be a good use of time to concretely implement every single one.

Instead, an approach using the __call magic method was used. The JSON document was read into an internal array, and the __call method was implemented to look at the name of the called method and any parameters provided to find the desired property. By using magic methods instead of object properties, it allowed descent into the JSON document without needing intermediary variables or loops.

This left the issue of having many possible available properties, and wanting IDE hinting on them, solved by magicdoc.

Configuration

Magicdoc expects a magicdoc.json file. This file should be an array of objects, each object representing a json document and a class that it will be mapped to.

source: required, specifies the location of the json file to map

destination: required, the location of the destination class

types: optional, allows specifying types for certain elements. Magicdoc will infer basic types (string, bool, integer), but this allows to specify objects.

parameters: optional, allows specifying a list of arguments. Magicdoc will default to a standard variadic parameter (...$parameters)

Finally, the destination class must have the {{magicdoc_start}} and {{magicdoc_end}} tags added in the location you want the @method listing to appear. Generally, this is in the class docblock.

Url configuration

Magicdoc can also read directly from your api.

source: specifies the options to pass to make the api request. The following options are not required- headers, body, method (defaults to GET).

options: specifies actions to take with the received json, mostly preprocessing

options=>bust_wrapper_array: if your API wraps returned objects in an array, you can set this option to pop the first object out of the array to be used for documentation generation.

Magento Model IDE Helper

Magicdoc can also generate an IDE helper for magic getters/setters in Magento models.

Magicdoc expects the magicdoc.json file to be in the root of your magento installation.

The provided id should be a valid instance of the model, as magicdoc will inspect the types of the data contained to determine accurate return types. It will then generate a __mage_ide_helper.php file, which should be placed in the root of your magento project.

Usage

Run magicdoc from the directory containing your magicdoc.json.

License

MIT


All versions of magicdoc with dependencies

PHP Build Version
Package Version
Requires php Version >=5.5.0
ext-json Version *
symfony/console Version ~2.7
guzzlehttp/guzzle Version ^6.1.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package linusshops/magicdoc contains the following files

Loading the files please wait ....