Download the PHP package dmachehin/sheet-mapper without Composer

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

Sheet Mapper

PHP библиотека, которая превращает строки CSV/XLS/XLSX в DTO-классы на основе атрибутов-схем. Внутри используется PhpSpreadsheet, так что поддерживаются как таблицы с заголовками, так и файлы с фиксированными колонками.

Возможности

Быстрый старт

DTO с атрибутами:

Чтение файла:

Если target_sheet не задан, map() пройдёт по всем листам workbook и вернёт объединённый результат.

Чтение без заголовков

Если в листе нет строки заголовков, установите has_header_row: false и укажите индекс колонки:

Merge-ячейки

По умолчанию merge-ячейки не разворачиваются: дочерние ячейки диапазона считаются пустыми. Если для конкретного поля нужно читать значение из верхней левой ячейки merge-диапазона, включите allow_merge: true.

Это полезно для вертикально объединённых ячеек, где значение задано только в первой строке группы.

Проверка структуры листа

Если обязательная колонка/заголовок не найден, будет выброшено SheetMapperException. Лишние заголовки тоже приводят к ошибке. Все элементы из ignored_columns допускается пропустить и/или оставить в файле как исключения — полю останется значение по умолчанию.

Регулярные выражения для заголовков

Поле name найдёт любую колонку, чей заголовок начинается со слова «Product». Можно комбинировать header и header_regexp, но как минимум одно из column, header, header_regexp должно быть задано.

Регулярные выражения для значений

value_regexp проверяет каждое непустое значение и выбрасывает SheetMapperException, если оно не совпало с шаблоном.

Кастомные преобразования значений

Если стандартного приведения типов недостаточно, используйте value_callback — он получает исходное значение ячейки и должен вернуть преобразованный результат (подойдёт любая callable: 'trim', ['ClassName', 'method'] и т.п.).

При ошибке внутри callback будет выброшено SheetMapperException, так что можно смело кидать собственные исключения с пояснениями.


All versions of sheet-mapper with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
phpoffice/phpspreadsheet Version 3.*|4.*|5.*
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 dmachehin/sheet-mapper contains the following files

Loading the files please wait ...