PHP code example of s1dd / magus

1. Go to this page and download the library: Download s1dd/magus 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/ */

    

s1dd / magus example snippets


'providers' => [
  ...
  'S1dd\Magus\MagusServiceProvider',
  ...
];

'aliases' => [
  ...
  'Magus' => 'S1dd\Magus\MagusFacade',
  ...
];

$dataString = "First Name,Last Name\rSidd,Sridharan";
$data = Magus::parseString($dataString);

Magus::import('client', $data);

return [
  'map' => [
    'Client' => [
      'Name' => 'name',
      'First Name' => 'fname',
      'Last Name' => 'lname'
    ]
  ]
];

return [

  'Client' => [

    'First Name' => function($value) {
      return strtoupper($value);
    },

    'Last Name' => function($value) {
      return strtolower($value);
    },
  ]

]
app/config/app.php

$ php artisan config:publish s1dd/magus

app/config/packages/s1dd/magus/config.php
app/config/packages/s1dd/magus/fieldmaps.php
fieldmaps.php
config.php