Download the PHP package ahmadpriatama/xls-woles without Composer

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

xls-woles Build Status

Installation

The preferred way to install this extension is through composer.

Install

Either run

or add

to the section of your composer.json file.

Demo

see folder

Usage Example

We have a list of children book in Book1.xlsx as shown below

alt tag

And your supervisor want clean data to be imported with specs:

  1. Book name must stored in lower case string
  2. Must split author name into first name and last name
  3. ISBN must stored in format XXX-X-XX-XXXXXX-X
  4. Language must stored in constant value ex: Book::LANG_EN = 1 or Book::LANG_NON_EN = 2

and this is your script

$config = json_decode(file_get_contents($fileConfig), true);
$data = \XLSWoles\Reader::load($fileInput)
    ->setSheetName('Sheet1')
    ->setColumnConfig($config['columns'])
    ->setDataRange('a2:e6')
    ->fetch();

column-config.json:

{
  "columns" : {
    "book-name": {
      "filters": [
        "string-lowercase"
      ]
    },
    "author-name": {
      "filters":[
        "SplitNameFilter"
      ]
    },
    "publisher": {},
    "isbn": {
      "filters": [
        "regex||-||",
        "regex||(\\d{3})(\\d{1})(\\d{2})(\\d{6})(\\d{1})||$1-$2-$3-$4-$5"
      ]
    },
    "language": {
      "filters": [
        "string-lowercase",
        "regex||english||1"
      ]
    }
  }
}

you see that author-name field has SplitNameFilter which is a custom filter which source code as shown below:

 <?php

 /**
  * Class SplitNameFilter
  * @author Ahmad Priatama <[email protected]>
  * @since 2016.08.28
  */
 class SplitNameFilter
 {

     /**
      * @param string $input Input String
      * @return array
      */
     public function process($input)
     {
         $arr = explode(' ', $input);
         $count = count($arr);
         if ($count == 1) {
             return [
                 'first-name' => $arr[0],
                 'last-name' => null,
             ];
         } else {
             return [
                 'first-name' => implode(' ', array_slice($arr, 0, $count-1)),
                 'last-name' => $arr[$count-1],
             ];
         }
     }
 }

print_r($data); should give you

Array
(
    [0] => Array
        (
            [book-name] => where the wild things are
            [author-name] => Array
                (
                    [first-name] => Maurice
                    [last-name] => Sendak
                )

            [publisher] => HarperCollins
            [isbn] => 978-0-06-443178-1
            [language] => 1
        )

    [1] => Array
        (
            [book-name] => the snowy day
            [author-name] => Array
                (
                    [first-name] => Ezra Jack
                    [last-name] => Keats
                )

            [publisher] => Puffin Books
            [isbn] => 978-0-14-050182-7
            [language] => 1
        )

    [2] => Array
        (
            [book-name] => goodnight moon
            [author-name] => Array
                (
                    [first-name] => Margaret Wise
                    [last-name] => Brown
                )

            [publisher] => HarperCollins
            [isbn] => 978-0-06-443017-3
            [language] => 1
        )

    [3] => Array
        (
            [book-name] => owl moon
            [author-name] => Array
                (
                    [first-name] => Jane
                    [last-name] => Yolen
                )

            [publisher] => Philomel Books
            [isbn] => 978-0-39-921457-8
            [language] => 1
        )

    [4] => Array
        (
            [book-name] => the giving tree
            [author-name] => Array
                (
                    [first-name] => Shel
                    [last-name] => Silverstein
                )

            [publisher] => Harper & Row
            [isbn] => 978-0-06-025665-4
            [language] => 1
        )

)

Built-in Filters

  1. Regex Replace
  2. String Lowercase
  3. String Uppercase
  4. String to Time
  5. Default Value
  6. Null on Empty

All versions of xls-woles with dependencies

PHP Build Version
Package Version
Requires phpoffice/phpexcel Version ^1.8
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 ahmadpriatama/xls-woles contains the following files

Loading the files please wait ....