Download the PHP package drbonzo/metassione without Composer

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

metassione

POPO to stdClass

This allows to convert complex object to stdClass, and later JSON (with json_encode()).

Example

Build object hierarchy

$post = new \Blog\Post();
$post->setTitle('il titolo');
$post->setContents('Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Ut posuere risus eu commodo fermentum. Nullam nec dignissim est.
Curabitur adipiscing massa sit amet velit vehicula aliquam.');

{
    $comment_1 = new \Blog\Comment();
    $comment_1->setAuthorName("l'autore 1");
    $comment_1->setContents("Lorem ipsum");

    $comment_2 = new \Blog\Comment();
    $comment_2->setAuthorName("l'autore 2");
    $comment_2->setContents("dolor sit amet");

    $comments = [$comment_1, $comment_2];
    $post->setComments($comments);
}

Converting to stdClass:

$metassione = new \NorthslopePL\Metassione\Metassione();
$rawData = $metassione->convertToStdClass($post);
print_r($rawData);

gives:

stdClass Object
(
    [title] => il titolo
    [contents] => Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Ut posuere risus eu commodo fermentum. Nullam nec dignissim est.
Curabitur adipiscing massa sit amet velit vehicula aliquam.
    [comments] => Array
        (
            [0] => stdClass Object
                (
                    [authorName] => l'autore 1
                    [contents] => Lorem ipsum
                )

            [1] => stdClass Object
                (
                    [authorName] => l'autore 2
                    [contents] => dolor sit amet
                )

        )

)

Then we can convert that to JSON (JSON_PRETTY_PRINT = php 5.4+): ​
$json = json_encode($rawData, JSON_PRETTY_PRINT); print($json);

which gives:

{
    "title": "il titolo",
    "contents": "Lorem ipsum dolor sit amet, consectetur adipiscing elit.\nUt posuere risus eu commodo fermentum. Nullam nec dignissim est.\nCurabitur adipiscing massa sit amet velit vehicula aliquam.",
    "comments": [
        {
            "authorName": "l'autore 1",
            "contents": "Lorem ipsum"
        },
        {
            "authorName": "l'autore 2",
            "contents": "dolor sit amet"
        }
    ]
}

stdClass to POPO

This allows to convert data from JSON into POPO. Instead of reading data from unspecified objects and arrays - you can use your own classes, type hinting, etc.

With your POPOs:

$comments = $post->getComments();
echo $comments[0]->getAuthor();
echo $comments[0]->getContents();

Compare this to arrays and stdClasses (no type/method hinting):

echo $post->comments[0]->author;
echo $post->comments[0]->contents;

Example

We are using $rawData from example above, to build the same \Blog\Post object:

$otherPost = new \Blog\Post();
$metassione->fillObjectWithRawData($otherPost, $rawData);

print_r($otherPost);

which gives:

Blog\Post Object
(
    [title:Blog\Post:private] => il titolo
    [contents:Blog\Post:private] => Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Ut posuere risus eu commodo fermentum. Nullam nec dignissim est.
Curabitur adipiscing massa sit amet velit vehicula aliquam.
    [comments:Blog\Post:private] => Array
        (
            [0] => Blog\Comment Object
                (
                    [authorName:Blog\Comment:private] => l'autore 1
                    [contents:Blog\Comment:private] => Lorem ipsum
                )

            [1] => Blog\Comment Object
                (
                    [authorName:Blog\Comment:private] => l'autore 2
                    [contents:Blog\Comment:private] => dolor sit amet
                )

        )

)

Which is equal to our starting $post object.

why 'metassione'

  1. METASSIONE
  2. METAdati e di rifleSSIONE
  3. metadati e di riflessione
  4. translate to english: metadata and reflection

Building POPOs

To make Metassione work, you need to add typehinting and phpdocs to your classes.

Example:

available property types

Changelog

0.6.1 Updated tests to phpunit 5.4

0.6.0 Total rewrite

Upgrading 0.4.0 -> 0.6.0

Metassione 0.6.0 is more strict when processing values for properties.

0.4.0

Properties without full class name may be used.

Example:

This feature will not work with:


All versions of metassione with dependencies

PHP Build Version
Package Version
No informations.
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 drbonzo/metassione contains the following files

Loading the files please wait ....