Download the PHP package tarsisioxavier/magic-object without Composer

On this page you can find all versions of the php package tarsisioxavier/magic-object. 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 magic-object

Installation ๐Ÿ”Œ

Installation from composer.

Usage โ›๏ธ

DataModel it's a abstract class, which means it cannot be instantiated. You'll need to create another class and extend from it.

Attributes

DataModel contains a property which holds all the attributes of the class - except the ones matching some class' property - making them accessable like the property exists within the class.

You may notice an "original" property in your objects, that's just to hold the attributes passed to the class' contructor.

This is usefull when you're encapsulating data comming from APIs to log some stuff and debug when needed.

Attributes Accessors

If you need to modify the way you access the object's attribute, you can write an accessor in the object extending the DataModel.

The example below creates a object with name and CNPJ. The accessor in the ExampleClass will try to return the CPF of the object, since it doesn't exists a CNPJ will be returned.

Attributes Mutators

When you want to modify the data before filling your object, there is a option to write a mutator to this specific(s) attribute(s).

The example below will receive a DateTime object and will transform it into a simple string carring only the year, month, day, the hour and the minutes from the value (parameter) informed.

Bootable Traits

You can run any code when your class extending from DataModel is instantiated. Look the example below:

Notice that the method must match with the trait's name.
This is completly optional, if the method for booting it's not implemented the DataModel class will just ignore it.

Testing ๐Ÿงช

Run all the tests executing composer test, if you want a specific test to run, try: composer test -- --filter <the_test_you_want>.

Composer's script 'test' uses the Pest PHP.

You can also check the code coverage by using the command composer coverage, this will create a HTML file inside ./.coverage directory.

There is also a code quality assurance by PHPStan, run composer phpstan whenever you want to check that.

And last but not least, you can use the Pest Mutation feature by running composer test -- --mutate --parallel.


All versions of magic-object with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
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 tarsisioxavier/magic-object contains the following files

Loading the files please wait ....