Download the PHP package viral-agency/master-caster without Composer

On this page you can find all versions of the php package viral-agency/master-caster. 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 master-caster

PHP MasterCaster

Latest Stable Version Total Downloads License

Unlike other strongly typed languages (such as Java), PHP typically converts API requests from/to JSON using arrays. The problem with this approach is that it is impossible to know upfront the number, names, or types of properties being converted. This leads to unpredictable scenarios and makes the code harder to maintain. As a result, developers are often forced into complex technical workarounds, which, over time, become unmanageable. This is especially true when dealing with deeply nested JSON properties, where developers are forced to write iterative loops, resulting in messy and poorly maintainable code. MasterCaster bridges the gap between strong typing and PHP's flexibility. It allows you to define a model where the properties of objects are specified in advance, based on the third-party API documentation. This enables JSON responses to be dynamically and recursively converted into specific objects. At the same time, it lets you define custom methods within the classes, taking full advantage of OOP principles such as inheritance, encapsulation, and polymorphism.

In short, it’s a small revolution in PHP.

Requirements

Installation

To install the package, run the following command using Composer:

Alternatively, you can add the package to your composer.json file:

Then, run:

Usage

You can easily to use MasterCaster by defining a model from the third party API documentation:

Sample third-party API documentation

Here a sample third party API documentation that fits the Google JSON style guide

Define the models

Define each elements of the JSON representation by coping directly from the documentation, in order to be sure that's correct.

Sample Response Class

Sample Object Class

Please note: you are free to put all the nested objects that you need.

Replace the name following the third-party documentation.

Features

Troubleshooting

Array of objects name is not pluralized

Yeah. In some cases the array of objects is not pluralized. You are free to override the base method in order to match your name, by adding an intermediate class. In my case, the "video" object array wasn't pluralized:

Contributing

Contributions are welcome! If you find problems, please report by open a support request, thanks

Support

If you encounter issues, feel free to open an issue in the GitHub repository.

License

This package is open-sourced software licensed under the Apache 2 License.



All versions of master-caster with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0
doctrine/inflector Version ^2.0
phpunit/phpunit Version ^9.0.0
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 viral-agency/master-caster contains the following files

Loading the files please wait ....