PHP code example of danack / convert
1. Go to this page and download the library: Download danack/convert library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
danack / convert example snippets
$json = '{"id":1,"title":"Example","text":"This is an example of how to make an object convertible to Json."}';
$article = Article::fromJson($json);
echo "Id is: " . $article->getId() . "\n";
echo "Title is: " . $article->getTitle() . "\n";
// output is:
// Id is: 1
// Title is: Example