1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-19 16:01:34 +02:00

Fixes for i2g imports

This commit is contained in:
David Bomba 2024-05-23 14:14:59 +10:00
parent 603f571b47
commit 673eaaf3e5
3 changed files with 387 additions and 323 deletions

View File

@ -11,6 +11,7 @@
namespace App\Import\Transformer\Invoice2Go;
use App\DataMapper\InvoiceItem;
use App\Import\ImportException;
use App\Import\Transformer\BaseTransformer;
use App\Models\Invoice;
@ -26,6 +27,8 @@ class InvoiceTransformer extends BaseTransformer
*
* @return bool|array
*/
private $is_amount_discount = false;
public function transform($invoice_data)
{
if (!isset($invoice_data['DocumentNumber'])) {
@ -39,9 +42,14 @@ class InvoiceTransformer extends BaseTransformer
$invoiceStatusMap = [
'unsent' => Invoice::STATUS_DRAFT,
'sent' => Invoice::STATUS_SENT,
'fully_paid' => Invoice::STATUS_PAID,
];
$this->is_amount_discount = $this->getFloat($invoice_data, 'Discount') > 0 ? true : false;
$transformed = [
'is_amount_discount' => $this->is_amount_discount,
'discount' => $this->getFloat($invoice_data, 'Discount'),
'company_id' => $this->company->id,
'number' => $this->getString($invoice_data, 'DocumentNumber'),
'notes' => $this->getString($invoice_data, 'Comment'),
@ -51,14 +59,7 @@ class InvoiceTransformer extends BaseTransformer
'status_id' => $invoiceStatusMap[$status =
strtolower($this->getString($invoice_data, 'DocumentStatus'))] ?? Invoice::STATUS_SENT,
// 'viewed' => $status === 'viewed',
'line_items' => [
[
'cost' => $this->getFloat($invoice_data, 'TotalAmount'),
'quantity' => 1,
'discount' => $this->getFloat($invoice_data, 'DiscountValue'),
'is_amount_discount' => false,
],
],
'line_items' => $this->harvestLineItems($invoice_data),
];
$client_id = null;
@ -88,6 +89,11 @@ class InvoiceTransformer extends BaseTransformer
],
],
];
$addresses = $this->harvestAddresses($invoice_data);
$transformed['client'] = array_merge($transformed['client'], $addresses);
}
if (! empty($invoice_data['Date Paid'])) {
$transformed['payments'] = [
@ -97,7 +103,199 @@ class InvoiceTransformer extends BaseTransformer
],
];
}
elseif(isset($invoice_data['AmountPaidAmount']) && isset($invoice_data['DatePaid'])){
$transformed['payments'] = [
[
'date' => $this->parseDate($invoice_data['DatePaid']),
'amount' => $this->getFloat($invoice_data, 'AmountPaidAmount'),
]
];
}
elseif(isset($invoice_data['DocumentStatus']) && $invoice_data['DocumentStatus'] == 'fully_paid'){
$transformed['payments'] = [
[
'date' => isset($invoice_data['DatePaid']) ? $this->parseDate($invoice_data['DatePaid']) : ($this->parseDate($invoice_data['DocumentDate']) ?? now()->format('Y-m-d')),
'amount' => $this->getFloat($invoice_data, 'TotalAmount'),
]
];
}
return $transformed;
}
private function harvestAddresses($invoice_data) {
$address = $invoice_data['DocumentRecipientAddress'];
$lines = explode("\n", $address);
$billing_address = [];
if(count($lines) == 2){
$billing_address['address1'] = $lines[0];
$parts = explode(",", $lines[1]);
if(count($parts) == 3){
$billing_address['city'] = $parts[0];
$billing_address['state'] = $parts[1];
$billing_address['postal_code'] = $parts[2];
}
}
$shipaddress = $invoice_data['ShipAddress'] ?? '';
$shipping_address = [];
$lines = explode("\n", $shipaddress);
if(count($lines) == 2) {
$shipping_address['address1'] = $lines[0];
$parts = explode(",", $lines[1]);
if(count($parts) == 3) {
$shipping_address['shipping_city'] = $parts[0];
$shipping_address['shipping_state'] = $parts[1];
$shipping_address['shipping_postal_code'] = $parts[2];
}
}
return array_merge($billing_address, $shipping_address);
}
/*
Sample invoice2go line item
"code" => "",
"description" => "",
"qty" => "1",
"unit_type" => "parts",
"withholding_tax_applies" => "false",
"applied_taxes" => "",
"unit_price" => "150",
"discount_percentage" => "50",
"discount_type" => "percentage", //amount
"discount_amount" => "0",
*/
private function harvestLineItems(array $invoice_data): array
{
$default_data =
[
[
'cost' => $this->getFloat($invoice_data, 'TotalAmount'),
'quantity' => 1,
'discount' => $this->getFloat($invoice_data, 'DiscountValue'),
'is_amount_discount' => false,
],
];
if(!isset($invoice_data['Items'])){
return $default_data;
}
// Parse the main CSV data
$processed = $this->parseCsvWithNestedCsv($invoice_data['Items']);
$line_items = [];
foreach($processed as $item)
{
$_item['cost'] = $item['unit_price'];
$_item['quantity'] = $item['qty'] ?? 1;
$_item['discount'] = $item['discount_percentage'] > $item['discount_amount'] ? $item['discount_percentage'] : $item['discount_amount'];
$_item['is_amount_discount'] = $item['discount_type'] == 'percentage' ? false : true;
$_item['product_key'] = $item['code'] ?? '';
$_item['notes'] = $item['description'] ?? '';
$_item = $this->parseTaxes($_item, $item);
$this->is_amount_discount = $_item['is_amount_discount'];
$line_items[] = $_item;
$_item = [];
}
return $line_items;
}
private function parseTaxes($ninja_item, $i2g_item): array
{
if(is_string($i2g_item['applied_taxes']))
return $ninja_item;
$ninja_item['tax_name1'] = 'Tax';
$ninja_item['tax_rate1'] = $i2g_item['applied_taxes']['rate'];
return $ninja_item;
}
function parseCsvWithNestedCsv($csvString, $delimiter = ',', $enclosure = '"', $lineEnding = ';')
{
// Regular expression to find nested CSVs
$nestedCsvPattern = '/"([^"]*(?:""[^"]*)*)"/';
preg_match_all($nestedCsvPattern, $csvString, $matches);
// Replace nested CSVs with placeholders
$placeholders = [];
foreach ($matches[0] as $index => $match) {
$placeholder = '___PLACEHOLDER_' . $index . '___';
$placeholders[$placeholder] = $match;
$csvString = str_replace($match, $placeholder, $csvString);
}
// Parse the main CSV
$rows = explode($lineEnding, $csvString);
$parsedRows = [];
foreach ($rows as $row) {
$parsedRow = str_getcsv($row, $delimiter, $enclosure);
$parsedRows[] = $parsedRow;
}
// Replace placeholders with parsed nested CSVs
foreach ($parsedRows as &$row) {
foreach ($row as &$field) {
if (isset($placeholders[$field])) {
$field = str_getcsv($placeholders[$field], $delimiter, $enclosure);
}
}
}
foreach($parsedRows as $key => &$row) {
if($key == 0) {
continue;
}
if(is_array($row[5])) {
$csv = str_getcsv($row[5][0], ";");
$row[5] = array_combine(explode(",", $csv[0]), explode(",", $csv[1]));
}
if(is_array($row[1])) {
$row[1] = $row[1][0];
}
$row = array_combine($parsedRows[0], $row);
}
unset($parsedRows[0]);
return $parsedRows;
}
}

376
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "fa16490174cf1031f3b7de1dba43be9f",
"content-hash": "1356155e46e797b140685c105df97b8e",
"packages": [
{
"name": "adrienrn/php-mimetyper",
@ -1385,16 +1385,16 @@
},
{
"name": "aws/aws-sdk-php",
"version": "3.308.0",
"version": "3.308.1",
"source": {
"type": "git",
"url": "https://github.com/aws/aws-sdk-php.git",
"reference": "806ad75dcb72b6e6569848159e7a350003526bc9"
"reference": "bf5f1221d4c5c67d3213150fb91dfb5ce627227b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/806ad75dcb72b6e6569848159e7a350003526bc9",
"reference": "806ad75dcb72b6e6569848159e7a350003526bc9",
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/bf5f1221d4c5c67d3213150fb91dfb5ce627227b",
"reference": "bf5f1221d4c5c67d3213150fb91dfb5ce627227b",
"shasum": ""
},
"require": {
@ -1474,9 +1474,9 @@
"support": {
"forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80",
"issues": "https://github.com/aws/aws-sdk-php/issues",
"source": "https://github.com/aws/aws-sdk-php/tree/3.308.0"
"source": "https://github.com/aws/aws-sdk-php/tree/3.308.1"
},
"time": "2024-05-21T18:06:10+00:00"
"time": "2024-05-22T18:05:56+00:00"
},
{
"name": "bacon/bacon-qr-code",
@ -2509,16 +2509,16 @@
},
{
"name": "doctrine/event-manager",
"version": "2.0.0",
"version": "2.0.1",
"source": {
"type": "git",
"url": "https://github.com/doctrine/event-manager.git",
"reference": "750671534e0241a7c50ea5b43f67e23eb5c96f32"
"reference": "b680156fa328f1dfd874fd48c7026c41570b9c6e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/event-manager/zipball/750671534e0241a7c50ea5b43f67e23eb5c96f32",
"reference": "750671534e0241a7c50ea5b43f67e23eb5c96f32",
"url": "https://api.github.com/repos/doctrine/event-manager/zipball/b680156fa328f1dfd874fd48c7026c41570b9c6e",
"reference": "b680156fa328f1dfd874fd48c7026c41570b9c6e",
"shasum": ""
},
"require": {
@ -2528,10 +2528,10 @@
"doctrine/common": "<2.9"
},
"require-dev": {
"doctrine/coding-standard": "^10",
"doctrine/coding-standard": "^12",
"phpstan/phpstan": "^1.8.8",
"phpunit/phpunit": "^9.5",
"vimeo/psalm": "^4.28"
"phpunit/phpunit": "^10.5",
"vimeo/psalm": "^5.24"
},
"type": "library",
"autoload": {
@ -2580,7 +2580,7 @@
],
"support": {
"issues": "https://github.com/doctrine/event-manager/issues",
"source": "https://github.com/doctrine/event-manager/tree/2.0.0"
"source": "https://github.com/doctrine/event-manager/tree/2.0.1"
},
"funding": [
{
@ -2596,7 +2596,7 @@
"type": "tidelift"
}
],
"time": "2022-10-12T20:59:15+00:00"
"time": "2024-05-22T20:47:39+00:00"
},
{
"name": "doctrine/inflector",
@ -5034,18 +5034,17 @@
"source": {
"type": "git",
"url": "https://github.com/invoiceninja/einvoice.git",
"reference": "f48e3c4c733be16df80330890fbe13ae476b86b7"
"reference": "757800fa89f845443ad1880c1ea7aa905d1043ea"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/invoiceninja/einvoice/zipball/f48e3c4c733be16df80330890fbe13ae476b86b7",
"reference": "f48e3c4c733be16df80330890fbe13ae476b86b7",
"url": "https://api.github.com/repos/invoiceninja/einvoice/zipball/757800fa89f845443ad1880c1ea7aa905d1043ea",
"reference": "757800fa89f845443ad1880c1ea7aa905d1043ea",
"shasum": ""
},
"require": {
"illuminate/collections": "^10.48",
"sabre/xml": "^4.0",
"spatie/laravel-data": "^4",
"symfony/property-access": "^6.4",
"symfony/serializer": "^6.4",
"symfony/validator": "^6.4"
@ -5078,7 +5077,7 @@
"source": "https://github.com/invoiceninja/einvoice/tree/main",
"issues": "https://github.com/invoiceninja/einvoice/issues"
},
"time": "2024-05-22T05:54:35+00:00"
"time": "2024-05-22T07:45:24+00:00"
},
{
"name": "invoiceninja/inspector",
@ -6228,34 +6227,34 @@
},
{
"name": "lcobucci/clock",
"version": "3.2.0",
"version": "3.0.0",
"source": {
"type": "git",
"url": "https://github.com/lcobucci/clock.git",
"reference": "6f28b826ea01306b07980cb8320ab30b966cd715"
"reference": "039ef98c6b57b101d10bd11d8fdfda12cbd996dc"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/lcobucci/clock/zipball/6f28b826ea01306b07980cb8320ab30b966cd715",
"reference": "6f28b826ea01306b07980cb8320ab30b966cd715",
"url": "https://api.github.com/repos/lcobucci/clock/zipball/039ef98c6b57b101d10bd11d8fdfda12cbd996dc",
"reference": "039ef98c6b57b101d10bd11d8fdfda12cbd996dc",
"shasum": ""
},
"require": {
"php": "~8.2.0 || ~8.3.0",
"php": "~8.1.0 || ~8.2.0",
"psr/clock": "^1.0"
},
"provide": {
"psr/clock-implementation": "1.0"
},
"require-dev": {
"infection/infection": "^0.27",
"lcobucci/coding-standard": "^11.0.0",
"phpstan/extension-installer": "^1.3.1",
"phpstan/phpstan": "^1.10.25",
"phpstan/phpstan-deprecation-rules": "^1.1.3",
"phpstan/phpstan-phpunit": "^1.3.13",
"phpstan/phpstan-strict-rules": "^1.5.1",
"phpunit/phpunit": "^10.2.3"
"infection/infection": "^0.26",
"lcobucci/coding-standard": "^9.0",
"phpstan/extension-installer": "^1.2",
"phpstan/phpstan": "^1.9.4",
"phpstan/phpstan-deprecation-rules": "^1.1.1",
"phpstan/phpstan-phpunit": "^1.3.2",
"phpstan/phpstan-strict-rules": "^1.4.4",
"phpunit/phpunit": "^9.5.27"
},
"type": "library",
"autoload": {
@ -6276,7 +6275,7 @@
"description": "Yet another clock abstraction",
"support": {
"issues": "https://github.com/lcobucci/clock/issues",
"source": "https://github.com/lcobucci/clock/tree/3.2.0"
"source": "https://github.com/lcobucci/clock/tree/3.0.0"
},
"funding": [
{
@ -6288,7 +6287,7 @@
"type": "patreon"
}
],
"time": "2023-11-17T17:00:27+00:00"
"time": "2022-12-19T15:00:24+00:00"
},
{
"name": "lcobucci/jwt",
@ -6643,16 +6642,16 @@
},
{
"name": "league/flysystem",
"version": "3.27.0",
"version": "3.28.0",
"source": {
"type": "git",
"url": "https://github.com/thephpleague/flysystem.git",
"reference": "4729745b1ab737908c7d055148c9a6b3e959832f"
"reference": "e611adab2b1ae2e3072fa72d62c62f52c2bf1f0c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/thephpleague/flysystem/zipball/4729745b1ab737908c7d055148c9a6b3e959832f",
"reference": "4729745b1ab737908c7d055148c9a6b3e959832f",
"url": "https://api.github.com/repos/thephpleague/flysystem/zipball/e611adab2b1ae2e3072fa72d62c62f52c2bf1f0c",
"reference": "e611adab2b1ae2e3072fa72d62c62f52c2bf1f0c",
"shasum": ""
},
"require": {
@ -6676,10 +6675,13 @@
"composer/semver": "^3.0",
"ext-fileinfo": "*",
"ext-ftp": "*",
"ext-mongodb": "^1.3",
"ext-zip": "*",
"friendsofphp/php-cs-fixer": "^3.5",
"google/cloud-storage": "^1.23",
"guzzlehttp/psr7": "^2.6",
"microsoft/azure-storage-blob": "^1.1",
"mongodb/mongodb": "^1.2",
"phpseclib/phpseclib": "^3.0.36",
"phpstan/phpstan": "^1.10",
"phpunit/phpunit": "^9.5.11|^10.0",
@ -6717,32 +6719,22 @@
],
"support": {
"issues": "https://github.com/thephpleague/flysystem/issues",
"source": "https://github.com/thephpleague/flysystem/tree/3.27.0"
"source": "https://github.com/thephpleague/flysystem/tree/3.28.0"
},
"funding": [
{
"url": "https://ecologi.com/frankdejonge",
"type": "custom"
},
{
"url": "https://github.com/frankdejonge",
"type": "github"
}
],
"time": "2024-04-07T19:17:50+00:00"
"time": "2024-05-22T10:09:12+00:00"
},
{
"name": "league/flysystem-aws-s3-v3",
"version": "3.27.0",
"version": "3.28.0",
"source": {
"type": "git",
"url": "https://github.com/thephpleague/flysystem-aws-s3-v3.git",
"reference": "3e6ce2f972f1470db779f04d29c289dcd2c32837"
"reference": "22071ef1604bc776f5ff2468ac27a752514665c8"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/thephpleague/flysystem-aws-s3-v3/zipball/3e6ce2f972f1470db779f04d29c289dcd2c32837",
"reference": "3e6ce2f972f1470db779f04d29c289dcd2c32837",
"url": "https://api.github.com/repos/thephpleague/flysystem-aws-s3-v3/zipball/22071ef1604bc776f5ff2468ac27a752514665c8",
"reference": "22071ef1604bc776f5ff2468ac27a752514665c8",
"shasum": ""
},
"require": {
@ -6782,32 +6774,22 @@
"storage"
],
"support": {
"source": "https://github.com/thephpleague/flysystem-aws-s3-v3/tree/3.27.0"
"source": "https://github.com/thephpleague/flysystem-aws-s3-v3/tree/3.28.0"
},
"funding": [
{
"url": "https://ecologi.com/frankdejonge",
"type": "custom"
},
{
"url": "https://github.com/frankdejonge",
"type": "github"
}
],
"time": "2024-04-07T19:16:54+00:00"
"time": "2024-05-06T20:05:52+00:00"
},
{
"name": "league/flysystem-local",
"version": "3.25.1",
"version": "3.28.0",
"source": {
"type": "git",
"url": "https://github.com/thephpleague/flysystem-local.git",
"reference": "61a6a90d6e999e4ddd9ce5adb356de0939060b92"
"reference": "13f22ea8be526ea58c2ddff9e158ef7c296e4f40"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/thephpleague/flysystem-local/zipball/61a6a90d6e999e4ddd9ce5adb356de0939060b92",
"reference": "61a6a90d6e999e4ddd9ce5adb356de0939060b92",
"url": "https://api.github.com/repos/thephpleague/flysystem-local/zipball/13f22ea8be526ea58c2ddff9e158ef7c296e4f40",
"reference": "13f22ea8be526ea58c2ddff9e158ef7c296e4f40",
"shasum": ""
},
"require": {
@ -6841,19 +6823,9 @@
"local"
],
"support": {
"source": "https://github.com/thephpleague/flysystem-local/tree/3.25.1"
"source": "https://github.com/thephpleague/flysystem-local/tree/3.28.0"
},
"funding": [
{
"url": "https://ecologi.com/frankdejonge",
"type": "custom"
},
{
"url": "https://github.com/frankdejonge",
"type": "github"
}
],
"time": "2024-03-15T19:58:44+00:00"
"time": "2024-05-06T20:05:52+00:00"
},
{
"name": "league/fractal",
@ -7296,16 +7268,16 @@
},
{
"name": "livewire/livewire",
"version": "v3.4.12",
"version": "v3.5.0",
"source": {
"type": "git",
"url": "https://github.com/livewire/livewire.git",
"reference": "54dd265c17f7b5200627eb9690590e7cbbad1027"
"reference": "72e900825c560f0e4e620185b26c5441a8914435"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/livewire/livewire/zipball/54dd265c17f7b5200627eb9690590e7cbbad1027",
"reference": "54dd265c17f7b5200627eb9690590e7cbbad1027",
"url": "https://api.github.com/repos/livewire/livewire/zipball/72e900825c560f0e4e620185b26c5441a8914435",
"reference": "72e900825c560f0e4e620185b26c5441a8914435",
"shasum": ""
},
"require": {
@ -7360,7 +7332,7 @@
"description": "A front-end framework for Laravel.",
"support": {
"issues": "https://github.com/livewire/livewire/issues",
"source": "https://github.com/livewire/livewire/tree/v3.4.12"
"source": "https://github.com/livewire/livewire/tree/v3.5.0"
},
"funding": [
{
@ -7368,7 +7340,7 @@
"type": "github"
}
],
"time": "2024-05-02T17:10:37+00:00"
"time": "2024-05-21T13:39:04+00:00"
},
{
"name": "maennchen/zipstream-php",
@ -11929,20 +11901,20 @@
},
{
"name": "spatie/laravel-data",
"version": "4.6.0",
"version": "3.12.0",
"source": {
"type": "git",
"url": "https://github.com/spatie/laravel-data.git",
"reference": "ee513f693f8ab8f915dc26cae079d7b2e5999a65"
"reference": "d44e04839407bc32b029be59ba80090a5f720e91"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/spatie/laravel-data/zipball/ee513f693f8ab8f915dc26cae079d7b2e5999a65",
"reference": "ee513f693f8ab8f915dc26cae079d7b2e5999a65",
"url": "https://api.github.com/repos/spatie/laravel-data/zipball/d44e04839407bc32b029be59ba80090a5f720e91",
"reference": "d44e04839407bc32b029be59ba80090a5f720e91",
"shasum": ""
},
"require": {
"illuminate/contracts": "^10.0|^11.0",
"illuminate/contracts": "^9.30|^10.0|^11.0",
"php": "^8.1",
"phpdocumentor/type-resolver": "^1.5",
"spatie/laravel-package-tools": "^1.9.0",
@ -11951,21 +11923,21 @@
"require-dev": {
"fakerphp/faker": "^1.14",
"friendsofphp/php-cs-fixer": "^3.0",
"inertiajs/inertia-laravel": "dev-master#4508fd1",
"livewire/livewire": "^3.0",
"inertiajs/inertia-laravel": "^0.6.3",
"mockery/mockery": "^1.6",
"nesbot/carbon": "^2.63",
"nette/php-generator": "^3.5",
"nunomaduro/larastan": "^2.0",
"orchestra/testbench": "^8.0|^9.0",
"pestphp/pest": "^2.31",
"pestphp/pest-plugin-laravel": "^2.0",
"pestphp/pest-plugin-livewire": "^2.1",
"orchestra/testbench": "^7.6|^8.0",
"pestphp/pest": "^1.22",
"pestphp/pest-plugin-laravel": "^1.3",
"phpbench/phpbench": "^1.2",
"phpstan/extension-installer": "^1.1",
"phpunit/phpunit": "^10.0",
"phpunit/phpunit": "^9.3",
"spatie/invade": "^1.0",
"spatie/laravel-typescript-transformer": "^2.3",
"spatie/pest-plugin-snapshots": "^2.1",
"spatie/laravel-typescript-transformer": "^2.1.6",
"spatie/pest-plugin-snapshots": "^1.1",
"spatie/phpunit-snapshot-assertions": "^4.2",
"spatie/test-time": "^1.2"
},
"type": "library",
@ -11978,7 +11950,8 @@
},
"autoload": {
"psr-4": {
"Spatie\\LaravelData\\": "src/"
"Spatie\\LaravelData\\": "src",
"Spatie\\LaravelData\\Database\\Factories\\": "database/factories"
}
},
"notification-url": "https://packagist.org/downloads/",
@ -12001,7 +11974,7 @@
],
"support": {
"issues": "https://github.com/spatie/laravel-data/issues",
"source": "https://github.com/spatie/laravel-data/tree/4.6.0"
"source": "https://github.com/spatie/laravel-data/tree/3.12.0"
},
"funding": [
{
@ -12009,7 +11982,7 @@
"type": "github"
}
],
"time": "2024-05-03T15:01:04+00:00"
"time": "2024-04-24T09:27:45+00:00"
},
{
"name": "spatie/laravel-package-tools",
@ -12500,20 +12473,20 @@
},
{
"name": "symfony/css-selector",
"version": "v7.0.7",
"version": "v6.4.7",
"source": {
"type": "git",
"url": "https://github.com/symfony/css-selector.git",
"reference": "b08a4ad89e84b29cec285b7b1f781a7ae51cf4bc"
"reference": "1c5d5c2103c3762aff27a27e1e2409e30a79083b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/css-selector/zipball/b08a4ad89e84b29cec285b7b1f781a7ae51cf4bc",
"reference": "b08a4ad89e84b29cec285b7b1f781a7ae51cf4bc",
"url": "https://api.github.com/repos/symfony/css-selector/zipball/1c5d5c2103c3762aff27a27e1e2409e30a79083b",
"reference": "1c5d5c2103c3762aff27a27e1e2409e30a79083b",
"shasum": ""
},
"require": {
"php": ">=8.2"
"php": ">=8.1"
},
"type": "library",
"autoload": {
@ -12545,7 +12518,7 @@
"description": "Converts CSS selectors to XPath expressions",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/css-selector/tree/v7.0.7"
"source": "https://github.com/symfony/css-selector/tree/v6.4.7"
},
"funding": [
{
@ -12561,7 +12534,7 @@
"type": "tidelift"
}
],
"time": "2024-04-18T09:29:19+00:00"
"time": "2024-04-18T09:22:46+00:00"
},
{
"name": "symfony/deprecation-contracts",
@ -12707,24 +12680,24 @@
},
{
"name": "symfony/event-dispatcher",
"version": "v7.0.7",
"version": "v6.4.7",
"source": {
"type": "git",
"url": "https://github.com/symfony/event-dispatcher.git",
"reference": "db2a7fab994d67d92356bb39c367db115d9d30f9"
"reference": "d84384f3f67de3cb650db64d685d70395dacfc3f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/db2a7fab994d67d92356bb39c367db115d9d30f9",
"reference": "db2a7fab994d67d92356bb39c367db115d9d30f9",
"url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/d84384f3f67de3cb650db64d685d70395dacfc3f",
"reference": "d84384f3f67de3cb650db64d685d70395dacfc3f",
"shasum": ""
},
"require": {
"php": ">=8.2",
"php": ">=8.1",
"symfony/event-dispatcher-contracts": "^2.5|^3"
},
"conflict": {
"symfony/dependency-injection": "<6.4",
"symfony/dependency-injection": "<5.4",
"symfony/service-contracts": "<2.5"
},
"provide": {
@ -12733,13 +12706,13 @@
},
"require-dev": {
"psr/log": "^1|^2|^3",
"symfony/config": "^6.4|^7.0",
"symfony/dependency-injection": "^6.4|^7.0",
"symfony/error-handler": "^6.4|^7.0",
"symfony/expression-language": "^6.4|^7.0",
"symfony/http-foundation": "^6.4|^7.0",
"symfony/config": "^5.4|^6.0|^7.0",
"symfony/dependency-injection": "^5.4|^6.0|^7.0",
"symfony/error-handler": "^5.4|^6.0|^7.0",
"symfony/expression-language": "^5.4|^6.0|^7.0",
"symfony/http-foundation": "^5.4|^6.0|^7.0",
"symfony/service-contracts": "^2.5|^3",
"symfony/stopwatch": "^6.4|^7.0"
"symfony/stopwatch": "^5.4|^6.0|^7.0"
},
"type": "library",
"autoload": {
@ -12767,7 +12740,7 @@
"description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/event-dispatcher/tree/v7.0.7"
"source": "https://github.com/symfony/event-dispatcher/tree/v6.4.7"
},
"funding": [
{
@ -12783,7 +12756,7 @@
"type": "tidelift"
}
],
"time": "2024-04-18T09:29:19+00:00"
"time": "2024-04-18T09:22:46+00:00"
},
{
"name": "symfony/event-dispatcher-contracts",
@ -13353,25 +13326,25 @@
},
{
"name": "symfony/intl",
"version": "v7.0.7",
"version": "v6.4.7",
"source": {
"type": "git",
"url": "https://github.com/symfony/intl.git",
"reference": "dd12042707110995e2e7d80103f8d9928bea8621"
"reference": "9ed7dfeeba5759b61798358100bb63230509b337"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/intl/zipball/dd12042707110995e2e7d80103f8d9928bea8621",
"reference": "dd12042707110995e2e7d80103f8d9928bea8621",
"url": "https://api.github.com/repos/symfony/intl/zipball/9ed7dfeeba5759b61798358100bb63230509b337",
"reference": "9ed7dfeeba5759b61798358100bb63230509b337",
"shasum": ""
},
"require": {
"php": ">=8.2"
"php": ">=8.1"
},
"require-dev": {
"symfony/filesystem": "^6.4|^7.0",
"symfony/finder": "^6.4|^7.0",
"symfony/var-exporter": "^6.4|^7.0"
"symfony/filesystem": "^5.4|^6.0|^7.0",
"symfony/finder": "^5.4|^6.0|^7.0",
"symfony/var-exporter": "^5.4|^6.0|^7.0"
},
"type": "library",
"autoload": {
@ -13416,7 +13389,7 @@
"localization"
],
"support": {
"source": "https://github.com/symfony/intl/tree/v7.0.7"
"source": "https://github.com/symfony/intl/tree/v6.4.7"
},
"funding": [
{
@ -13432,7 +13405,7 @@
"type": "tidelift"
}
],
"time": "2024-04-18T09:29:19+00:00"
"time": "2024-04-18T09:22:46+00:00"
},
{
"name": "symfony/mailer",
@ -13670,20 +13643,20 @@
},
{
"name": "symfony/options-resolver",
"version": "v7.0.7",
"version": "v6.4.7",
"source": {
"type": "git",
"url": "https://github.com/symfony/options-resolver.git",
"reference": "23cc173858776ad451e31f053b1c9f47840b2cfa"
"reference": "9a3c92b490716ba6771f5beced13c6eda7183eed"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/options-resolver/zipball/23cc173858776ad451e31f053b1c9f47840b2cfa",
"reference": "23cc173858776ad451e31f053b1c9f47840b2cfa",
"url": "https://api.github.com/repos/symfony/options-resolver/zipball/9a3c92b490716ba6771f5beced13c6eda7183eed",
"reference": "9a3c92b490716ba6771f5beced13c6eda7183eed",
"shasum": ""
},
"require": {
"php": ">=8.2",
"php": ">=8.1",
"symfony/deprecation-contracts": "^2.5|^3"
},
"type": "library",
@ -13717,7 +13690,7 @@
"options"
],
"support": {
"source": "https://github.com/symfony/options-resolver/tree/v7.0.7"
"source": "https://github.com/symfony/options-resolver/tree/v6.4.7"
},
"funding": [
{
@ -13733,7 +13706,7 @@
"type": "tidelift"
}
],
"time": "2024-04-18T09:29:19+00:00"
"time": "2024-04-18T09:22:46+00:00"
},
{
"name": "symfony/polyfill-ctype",
@ -14740,33 +14713,33 @@
},
{
"name": "symfony/property-info",
"version": "v7.0.7",
"version": "v6.4.7",
"source": {
"type": "git",
"url": "https://github.com/symfony/property-info.git",
"reference": "f0bdb46e19ab308527b324b7ec36161f6880a532"
"reference": "42778ca731b8796e02e237008f4ed871361ddfce"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/property-info/zipball/f0bdb46e19ab308527b324b7ec36161f6880a532",
"reference": "f0bdb46e19ab308527b324b7ec36161f6880a532",
"url": "https://api.github.com/repos/symfony/property-info/zipball/42778ca731b8796e02e237008f4ed871361ddfce",
"reference": "42778ca731b8796e02e237008f4ed871361ddfce",
"shasum": ""
},
"require": {
"php": ">=8.2",
"symfony/string": "^6.4|^7.0"
"php": ">=8.1",
"symfony/string": "^5.4|^6.0|^7.0"
},
"conflict": {
"phpdocumentor/reflection-docblock": "<5.2",
"phpdocumentor/type-resolver": "<1.5.1",
"symfony/dependency-injection": "<6.4",
"symfony/dependency-injection": "<5.4",
"symfony/serializer": "<6.4"
},
"require-dev": {
"phpdocumentor/reflection-docblock": "^5.2",
"phpstan/phpdoc-parser": "^1.0",
"symfony/cache": "^6.4|^7.0",
"symfony/dependency-injection": "^6.4|^7.0",
"symfony/cache": "^5.4|^6.0|^7.0",
"symfony/dependency-injection": "^5.4|^6.0|^7.0",
"symfony/serializer": "^6.4|^7.0"
},
"type": "library",
@ -14803,7 +14776,7 @@
"validator"
],
"support": {
"source": "https://github.com/symfony/property-info/tree/v7.0.7"
"source": "https://github.com/symfony/property-info/tree/v6.4.7"
},
"funding": [
{
@ -14819,7 +14792,7 @@
"type": "tidelift"
}
],
"time": "2024-04-28T11:44:19+00:00"
"time": "2024-04-28T10:28:08+00:00"
},
{
"name": "symfony/psr-http-message-bridge",
@ -15176,20 +15149,20 @@
},
{
"name": "symfony/string",
"version": "v7.0.7",
"version": "v6.4.7",
"source": {
"type": "git",
"url": "https://github.com/symfony/string.git",
"reference": "e405b5424dc2528e02e31ba26b83a79fd4eb8f63"
"reference": "ffeb9591c61f65a68d47f77d12b83fa530227a69"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/string/zipball/e405b5424dc2528e02e31ba26b83a79fd4eb8f63",
"reference": "e405b5424dc2528e02e31ba26b83a79fd4eb8f63",
"url": "https://api.github.com/repos/symfony/string/zipball/ffeb9591c61f65a68d47f77d12b83fa530227a69",
"reference": "ffeb9591c61f65a68d47f77d12b83fa530227a69",
"shasum": ""
},
"require": {
"php": ">=8.2",
"php": ">=8.1",
"symfony/polyfill-ctype": "~1.8",
"symfony/polyfill-intl-grapheme": "~1.0",
"symfony/polyfill-intl-normalizer": "~1.0",
@ -15199,11 +15172,11 @@
"symfony/translation-contracts": "<2.5"
},
"require-dev": {
"symfony/error-handler": "^6.4|^7.0",
"symfony/http-client": "^6.4|^7.0",
"symfony/intl": "^6.4|^7.0",
"symfony/error-handler": "^5.4|^6.0|^7.0",
"symfony/http-client": "^5.4|^6.0|^7.0",
"symfony/intl": "^6.2|^7.0",
"symfony/translation-contracts": "^2.5|^3.0",
"symfony/var-exporter": "^6.4|^7.0"
"symfony/var-exporter": "^5.4|^6.0|^7.0"
},
"type": "library",
"autoload": {
@ -15242,7 +15215,7 @@
"utf8"
],
"support": {
"source": "https://github.com/symfony/string/tree/v7.0.7"
"source": "https://github.com/symfony/string/tree/v6.4.7"
},
"funding": [
{
@ -15258,7 +15231,7 @@
"type": "tidelift"
}
],
"time": "2024-04-18T09:29:19+00:00"
"time": "2024-04-18T09:22:46+00:00"
},
{
"name": "symfony/translation",
@ -16737,16 +16710,16 @@
},
{
"name": "brianium/paratest",
"version": "v7.4.4",
"version": "v7.3.1",
"source": {
"type": "git",
"url": "https://github.com/paratestphp/paratest.git",
"reference": "bfe354e71aca261cf37bf70bf47791081100000d"
"reference": "551f46f52a93177d873f3be08a1649ae886b4a30"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/paratestphp/paratest/zipball/bfe354e71aca261cf37bf70bf47791081100000d",
"reference": "bfe354e71aca261cf37bf70bf47791081100000d",
"url": "https://api.github.com/repos/paratestphp/paratest/zipball/551f46f52a93177d873f3be08a1649ae886b4a30",
"reference": "551f46f52a93177d873f3be08a1649ae886b4a30",
"shasum": ""
},
"require": {
@ -16754,27 +16727,28 @@
"ext-pcre": "*",
"ext-reflection": "*",
"ext-simplexml": "*",
"fidry/cpu-core-counter": "^1.1.0",
"jean85/pretty-package-versions": "^2.0.6",
"php": "~8.2.0 || ~8.3.0",
"phpunit/php-code-coverage": "^10.1.14 || ^11.0.3",
"phpunit/php-file-iterator": "^4.1.0 || ^5.0.0",
"phpunit/php-timer": "^6.0.0 || ^7.0.0",
"phpunit/phpunit": "^10.5.20 || ^11.1.3",
"sebastian/environment": "^6.1.0 || ^7.1.0",
"symfony/console": "^6.4.7 || ^7.0.7",
"symfony/process": "^6.4.7 || ^7.0.7"
"fidry/cpu-core-counter": "^0.5.1 || ^1.0.0",
"jean85/pretty-package-versions": "^2.0.5",
"php": "~8.1.0 || ~8.2.0 || ~8.3.0",
"phpunit/php-code-coverage": "^10.1.7",
"phpunit/php-file-iterator": "^4.1.0",
"phpunit/php-timer": "^6.0",
"phpunit/phpunit": "^10.4.2",
"sebastian/environment": "^6.0.1",
"symfony/console": "^6.3.4 || ^7.0.0",
"symfony/process": "^6.3.4 || ^7.0.0"
},
"require-dev": {
"doctrine/coding-standard": "^12.0.0",
"ext-pcov": "*",
"ext-posix": "*",
"phpstan/phpstan": "^1.10.67",
"infection/infection": "^0.27.6",
"phpstan/phpstan": "^1.10.40",
"phpstan/phpstan-deprecation-rules": "^1.1.4",
"phpstan/phpstan-phpunit": "^1.3.16",
"phpstan/phpstan-strict-rules": "^1.5.5",
"squizlabs/php_codesniffer": "^3.9.2",
"symfony/filesystem": "^6.4.3 || ^7.0.7"
"phpstan/phpstan-phpunit": "^1.3.15",
"phpstan/phpstan-strict-rules": "^1.5.2",
"squizlabs/php_codesniffer": "^3.7.2",
"symfony/filesystem": "^6.3.1 || ^7.0.0"
},
"bin": [
"bin/paratest",
@ -16815,7 +16789,7 @@
],
"support": {
"issues": "https://github.com/paratestphp/paratest/issues",
"source": "https://github.com/paratestphp/paratest/tree/v7.4.4"
"source": "https://github.com/paratestphp/paratest/tree/v7.3.1"
},
"funding": [
{
@ -16827,7 +16801,7 @@
"type": "paypal"
}
],
"time": "2024-05-03T13:01:49+00:00"
"time": "2023-10-31T09:24:17+00:00"
},
{
"name": "clue/ndjson-react",
@ -20178,16 +20152,16 @@
},
{
"name": "spatie/flare-client-php",
"version": "1.5.1",
"version": "1.6.0",
"source": {
"type": "git",
"url": "https://github.com/spatie/flare-client-php.git",
"reference": "e27977d534eefe04c154c6fd8460217024054c05"
"reference": "220a7c8745e9fa427d54099f47147c4b97fe6462"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/spatie/flare-client-php/zipball/e27977d534eefe04c154c6fd8460217024054c05",
"reference": "e27977d534eefe04c154c6fd8460217024054c05",
"url": "https://api.github.com/repos/spatie/flare-client-php/zipball/220a7c8745e9fa427d54099f47147c4b97fe6462",
"reference": "220a7c8745e9fa427d54099f47147c4b97fe6462",
"shasum": ""
},
"require": {
@ -20235,7 +20209,7 @@
],
"support": {
"issues": "https://github.com/spatie/flare-client-php/issues",
"source": "https://github.com/spatie/flare-client-php/tree/1.5.1"
"source": "https://github.com/spatie/flare-client-php/tree/1.6.0"
},
"funding": [
{
@ -20243,7 +20217,7 @@
"type": "github"
}
],
"time": "2024-05-03T15:43:14+00:00"
"time": "2024-05-22T09:45:39+00:00"
},
{
"name": "spatie/ignition",
@ -20560,20 +20534,20 @@
},
{
"name": "symfony/stopwatch",
"version": "v7.0.7",
"version": "v6.4.7",
"source": {
"type": "git",
"url": "https://github.com/symfony/stopwatch.git",
"reference": "41a7a24aa1dc82adf46a06bc292d1923acfe6b84"
"reference": "ffec95ba269e541eb2232126c0c20f83086b5c68"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/stopwatch/zipball/41a7a24aa1dc82adf46a06bc292d1923acfe6b84",
"reference": "41a7a24aa1dc82adf46a06bc292d1923acfe6b84",
"url": "https://api.github.com/repos/symfony/stopwatch/zipball/ffec95ba269e541eb2232126c0c20f83086b5c68",
"reference": "ffec95ba269e541eb2232126c0c20f83086b5c68",
"shasum": ""
},
"require": {
"php": ">=8.2",
"php": ">=8.1",
"symfony/service-contracts": "^2.5|^3"
},
"type": "library",
@ -20602,7 +20576,7 @@
"description": "Provides a way to profile code",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/stopwatch/tree/v7.0.7"
"source": "https://github.com/symfony/stopwatch/tree/v6.4.7"
},
"funding": [
{
@ -20618,7 +20592,7 @@
"type": "tidelift"
}
],
"time": "2024-04-18T09:29:19+00:00"
"time": "2024-04-18T09:22:46+00:00"
},
{
"name": "theseer/tokenizer",

View File

@ -1,9 +1,7 @@
<?php
use Illuminate\Support\Enumerable;
return [
/**
/*
* The package will use this format when working with dates. If this option
* is an array, it will try to convert from the first format that works,
* and will serialize dates using the first format from the array.
@ -12,43 +10,27 @@ return [
'Y-m-d',
'Y-m-d\TH:i:s.uP',
],
/**
* It is possible to enable certain features of the package, these would otherwise
* be breaking changes, and thus they are disabled by default. In the next major
* version of the package, these features will be enabled by default.
*/
'features' => [
'cast_and_transform_iterables' => true,
/**
* When trying to set a computed property value, the package will throw an exception.
* You can disable this behaviour by setting this option to true, which will then just
* ignore the value being passed into the computed property and recalculate it.
*/
'ignore_exception_when_trying_to_set_computed_property_value' => false,
],
/**
/*
* Global transformers will take complex types and transform them into simple
* types.
*/
'transformers' => [
DateTimeInterface::class => \Spatie\LaravelData\Transformers\DateTimeInterfaceTransformer::class,
\Illuminate\Contracts\Support\Arrayable::class => \Spatie\LaravelData\Transformers\ArrayableTransformer::class,
BackedEnum::class => Spatie\LaravelData\Transformers\EnumTransformer::class,
BackedEnum::class => Spatie\LaravelData\Transformers\EnumTransformer::class
],
/**
/*
* Global casts will cast values into complex types when creating a data
* object from simple types.
*/
'casts' => [
DateTimeInterface::class => Spatie\LaravelData\Casts\DateTimeInterfaceCast::class,
BackedEnum::class => Spatie\LaravelData\Casts\EnumCast::class,
// Enumerable::class => Spatie\LaravelData\Casts\EnumerableCast::class,
],
/**
/*
* Rule inferrers can be configured here. They will automatically add
* validation rules to properties of a data object based upon
* the type of the property.
@ -75,7 +57,7 @@ return [
Spatie\LaravelData\Normalizers\JsonNormalizer::class,
],
/**
/*
* Data objects can be wrapped into a key like 'data' when used as a resource,
* this key can be set globally here for all data objects. You can pass in
* `null` if you want to disable wrapping.
@ -89,94 +71,4 @@ return [
* which will only enable the caster locally.
*/
'var_dumper_caster_mode' => 'development',
/**
* It is possible to skip the PHP reflection analysis of data objects
* when running in production. This will speed up the package. You
* can configure where data objects are stored and which cache
* store should be used.
*
* Structures are cached forever as they'll become stale when your
* application is deployed with changes. You can set a duration
* in seconds if you want the cache to clear after a certain
* timeframe.
*/
'structure_caching' => [
'enabled' => true,
'directories' => [app_path('Data')],
'cache' => [
'store' => env('CACHE_STORE', env('CACHE_DRIVER', 'file')),
'prefix' => 'laravel-data',
'duration' => null,
],
'reflection_discovery' => [
'enabled' => true,
'base_path' => base_path(),
'root_namespace' => null,
],
],
/**
* A data object can be validated when created using a factory or when calling the from
* method. By default, only when a request is passed the data is being validated. This
* behaviour can be changed to always validate or to completely disable validation.
*/
'validation_strategy' => \Spatie\LaravelData\Support\Creation\ValidationStrategy::OnlyRequests->value,
/**
* When using an invalid include, exclude, only or except partial, the package will
* throw an exception. You can disable this behaviour by setting this option to true.
*/
'ignore_invalid_partials' => false,
/**
* When transforming a nested chain of data objects, the package can end up in an infinite
* loop when including a recursive relationship. The max transformation depth can be
* set as a safety measure to prevent this from happening. When set to null, the
* package will not enforce a maximum depth.
*/
'max_transformation_depth' => null,
/**
* When the maximum transformation depth is reached, the package will throw an exception.
* You can disable this behaviour by setting this option to true which will return an
* empty array.
*/
'throw_when_max_transformation_depth_reached' => true,
/**
* When using the `make:data` command, the package will use these settings to generate
* the data classes. You can override these settings by passing options to the command.
*/
'commands' => [
/**
* Provides default configuration for the `make:data` command. These settings can be overridden with options
* passed directly to the `make:data` command for generating single Data classes, or if not set they will
* automatically fall back to these defaults. See `php artisan make:data --help` for more information
*/
'make' => [
/**
* The default namespace for generated Data classes. This exists under the application's root namespace,
* so the default 'Data` will end up as '\App\Data', and generated Data classes will be placed in the
* app/Data/ folder. Data classes can live anywhere, but this is where `make:data` will put them.
*/
'namespace' => 'Data',
/**
* This suffix will be appended to all data classes generated by make:data, so that they are less likely
* to conflict with other related classes, controllers or models with a similar name without resorting
* to adding an alias for the Data object. Set to a blank string (not null) to disable.
*/
'suffix' => 'Data',
],
],
/**
* When using Livewire, the package allows you to enable or disable the synths
* these synths will automatically handle the data objects and their
* properties when used in a Livewire component.
*/
'livewire' => [
'enable_synths' => false,
],
];