PHP code example of ralego / laravel-xml-parser
1. Go to this page and download the library: Download ralego/laravel-xml-parser 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/ */
ralego / laravel-xml-parser example snippets
use Ralego\Parser\Traits\XmlParser;
class HomeController extends Controller
{
use XmlParser;
public function test()
{
$xml = file_get_contents('http://www-db.deis.unibo.it/courses/TW/DOCS/w3schools/xml/cd_catalog.xml');
$object = $this->xmlToObject($xml);
$array = $this->xmlToArray($xml);
$json = $this->xmlToJson($xml);
dd($object, $array, $json);
}
}
config/xmlparser.php
bash
php artisan vendor:publish --tag=laravel-xml-parser