diff --git a/composer.json b/composer.json index 0f5255f..4d12406 100644 --- a/composer.json +++ b/composer.json @@ -8,9 +8,9 @@ "laravel", "package", "xml", - "middleware", + "request", "response", - "support" + "middleware" ], "authors": [ { @@ -21,12 +21,14 @@ } ], "require": { - "php": ">=5.6.4", - "illuminate/http": "~5.3.0|~5.4.0|~5.5.0|~5.6.0|~5.7.0|~5.8.0|^6.0|^7.0" + "php": "^7.2.5", + "illuminate/http": "^7.0", + "illuminate/support": "^7.0", + "illuminate/database": "^7.0" }, "require-dev": { - "phpunit/phpunit": "~5.0|~5.7|~6.0|^7.0|^7.5|^8.0|^8.4|^9.0", - "orchestra/testbench": "~3.3.0|~3.4.0|~3.5.0|~3.6.0|~3.7.0|~3.8.0|^4.0|^5.0" + "phpunit/phpunit": "^8.4|^9.0", + "orchestra/testbench": "^5.0" }, "autoload": { "psr-4": { diff --git a/composer.lock b/composer.lock index 292c829..74cbeac 100644 --- a/composer.lock +++ b/composer.lock @@ -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": "cc3fc3e49fab47b1f33c4a61d6146dc5", + "content-hash": "999cf1548f54eeebd3170996a4506005", "packages": [ { "name": "doctrine/inflector", @@ -249,16 +249,16 @@ }, { "name": "laravel/framework", - "version": "v7.0.4", + "version": "v7.0.8", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "b93848b43f1564521b3f0605f06a1b392391f6ff" + "reference": "d71ba61d51aec79a0a0f907991ec215dc24b09d4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/b93848b43f1564521b3f0605f06a1b392391f6ff", - "reference": "b93848b43f1564521b3f0605f06a1b392391f6ff", + "url": "https://api.github.com/repos/laravel/framework/zipball/d71ba61d51aec79a0a0f907991ec215dc24b09d4", + "reference": "d71ba61d51aec79a0a0f907991ec215dc24b09d4", "shasum": "" }, "require": { @@ -329,7 +329,7 @@ "aws/aws-sdk-php": "^3.0", "doctrine/dbal": "^2.6", "filp/whoops": "^2.4", - "guzzlehttp/guzzle": "^6.3|^7.0", + "guzzlehttp/guzzle": "^6.3.1|^7.0", "league/flysystem-cached-adapter": "^1.0", "mockery/mockery": "^1.3.1", "moontoast/math": "^1.1", @@ -349,7 +349,7 @@ "ext-redis": "Required to use the Redis cache and queue drivers.", "filp/whoops": "Required for friendly error pages in development (^2.4).", "fzaninotto/faker": "Required to use the eloquent factory builder (^1.9.1).", - "guzzlehttp/guzzle": "Required to use the HTTP Client, Mailgun mail driver and the ping methods on schedules (^6.3|^7.0).", + "guzzlehttp/guzzle": "Required to use the HTTP Client, Mailgun mail driver and the ping methods on schedules (^6.3.1|^7.0).", "laravel/tinker": "Required to use the tinker console command (^2.0).", "league/flysystem-aws-s3-v3": "Required to use the Flysystem S3 driver (^1.0).", "league/flysystem-cached-adapter": "Required to use the Flysystem cache (^1.0).", @@ -396,7 +396,7 @@ "framework", "laravel" ], - "time": "2020-03-04T22:37:20+00:00" + "time": "2020-03-08T16:03:46+00:00" }, { "name": "league/commonmark", @@ -474,16 +474,16 @@ }, { "name": "league/flysystem", - "version": "1.0.64", + "version": "1.0.65", "source": { "type": "git", "url": "https://github.com/thephpleague/flysystem.git", - "reference": "d13c43dbd4b791f815215959105a008515d1a2e0" + "reference": "8f17b3ba67097aafb8318cd5c553b1acf7c891c8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/d13c43dbd4b791f815215959105a008515d1a2e0", - "reference": "d13c43dbd4b791f815215959105a008515d1a2e0", + "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/8f17b3ba67097aafb8318cd5c553b1acf7c891c8", + "reference": "8f17b3ba67097aafb8318cd5c553b1acf7c891c8", "shasum": "" }, "require": { @@ -554,7 +554,7 @@ "sftp", "storage" ], - "time": "2020-02-05T18:14:17+00:00" + "time": "2020-03-08T18:53:20+00:00" }, { "name": "monolog/monolog", @@ -2637,16 +2637,16 @@ }, { "name": "voku/portable-ascii", - "version": "1.4.8", + "version": "1.4.9", "source": { "type": "git", "url": "https://github.com/voku/portable-ascii.git", - "reference": "a3801f5facf187a28cc2cae7b98a540c36406dc4" + "reference": "9fd2b224c71448b5f84aef9d499a1428d79776a2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/voku/portable-ascii/zipball/a3801f5facf187a28cc2cae7b98a540c36406dc4", - "reference": "a3801f5facf187a28cc2cae7b98a540c36406dc4", + "url": "https://api.github.com/repos/voku/portable-ascii/zipball/9fd2b224c71448b5f84aef9d499a1428d79776a2", + "reference": "9fd2b224c71448b5f84aef9d499a1428d79776a2", "shasum": "" }, "require": { @@ -2682,7 +2682,7 @@ "clean", "php" ], - "time": "2020-02-06T21:46:48+00:00" + "time": "2020-03-06T02:47:42+00:00" } ], "packages-dev": [ @@ -2955,22 +2955,22 @@ }, { "name": "orchestra/testbench", - "version": "v5.0.1", + "version": "v5.0.2", "source": { "type": "git", "url": "https://github.com/orchestral/testbench.git", - "reference": "3847c2230b45fb16a445b95b628ccd3517e39625" + "reference": "d2fb3f270f4413a8148336b3b902f45eb1ff4511" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/orchestral/testbench/zipball/3847c2230b45fb16a445b95b628ccd3517e39625", - "reference": "3847c2230b45fb16a445b95b628ccd3517e39625", + "url": "https://api.github.com/repos/orchestral/testbench/zipball/d2fb3f270f4413a8148336b3b902f45eb1ff4511", + "reference": "d2fb3f270f4413a8148336b3b902f45eb1ff4511", "shasum": "" }, "require": { - "laravel/framework": "^7.0.1", + "laravel/framework": "^7.0.6", "mockery/mockery": "^1.3.1", - "orchestra/testbench-core": "^5.0.1", + "orchestra/testbench-core": "^5.0.2", "php": ">=7.2.5", "phpunit/phpunit": "^8.4 || ^9.0" }, @@ -3001,20 +3001,20 @@ "orchestral", "testing" ], - "time": "2020-03-03T14:33:51+00:00" + "time": "2020-03-06T23:39:54+00:00" }, { "name": "orchestra/testbench-core", - "version": "v5.0.1", + "version": "v5.0.2", "source": { "type": "git", "url": "https://github.com/orchestral/testbench-core.git", - "reference": "2bf166beb0a7407acd312ffb75bf4917ec9a41e5" + "reference": "9fac37e442651664cab3025dc482a3933f494422" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/orchestral/testbench-core/zipball/2bf166beb0a7407acd312ffb75bf4917ec9a41e5", - "reference": "2bf166beb0a7407acd312ffb75bf4917ec9a41e5", + "url": "https://api.github.com/repos/orchestral/testbench-core/zipball/9fac37e442651664cab3025dc482a3933f494422", + "reference": "9fac37e442651664cab3025dc482a3933f494422", "shasum": "" }, "require": { @@ -3022,14 +3022,14 @@ "php": ">=7.2.5" }, "require-dev": { - "laravel/framework": "^7.0", + "laravel/framework": "^7.0.6", "laravel/laravel": "dev-master", "mockery/mockery": "^1.3.1", "orchestra/canvas": "^5.0", "phpunit/phpunit": "^8.4 || ^9.0" }, "suggest": { - "laravel/framework": "Required for testing (^7.0).", + "laravel/framework": "Required for testing (^7.0.6).", "mockery/mockery": "Allow using Mockery for testing (^1.3.1).", "orchestra/testbench-browser-kit": "Allow using legacy Laravel BrowserKit for testing (^5.0).", "orchestra/testbench-dusk": "Allow using Laravel Dusk for testing (^5.0).", @@ -3067,7 +3067,7 @@ "orchestral", "testing" ], - "time": "2020-03-03T14:02:06+00:00" + "time": "2020-03-06T23:32:49+00:00" }, { "name": "phar-io/manifest", @@ -3324,16 +3324,16 @@ }, { "name": "phpspec/prophecy", - "version": "v1.10.2", + "version": "v1.10.3", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "b4400efc9d206e83138e2bb97ed7f5b14b831cd9" + "reference": "451c3cd1418cf640de218914901e51b064abb093" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/b4400efc9d206e83138e2bb97ed7f5b14b831cd9", - "reference": "b4400efc9d206e83138e2bb97ed7f5b14b831cd9", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/451c3cd1418cf640de218914901e51b064abb093", + "reference": "451c3cd1418cf640de218914901e51b064abb093", "shasum": "" }, "require": { @@ -3383,7 +3383,7 @@ "spy", "stub" ], - "time": "2020-01-20T15:57:02+00:00" + "time": "2020-03-05T15:02:03+00:00" }, { "name": "phpunit/php-code-coverage", @@ -4495,7 +4495,7 @@ "prefer-stable": true, "prefer-lowest": false, "platform": { - "php": ">=5.6.4" + "php": "^7.2.5" }, "platform-dev": [] } diff --git a/readme.md b/readme.md index 12963ec..6e34945 100644 --- a/readme.md +++ b/readme.md @@ -7,40 +7,14 @@ This package comes with the much desired xml support for you Laravel project including middleware to accept only xml requests, http response in xml, and more utilities for xml conversions as well as validation. -**Supports:** Laravel versions 5.3, 5.4, 5.5, 5.6, 5.7, 5.8, 6.0, 7.0 +**Supports:** Laravel versions from v5.3 up to v7.0 ### Installation -`$ composer require bmatovu/laravel-xml` - -**Register Service Provider** - -Only for Laravel versions 5.3 and 5.4. For later Laravel versions, this package will be [auto-discovered](https://laravel.com/docs/master/packages#package-discovery). - -In `config/app.php` - -```php -'providers' => array( - // ... - Bmatovu\LaravelXml\LaravelXmlServiceProvider::class, -), -``` - -**Register Alias** - -In `config/app.php` - -```php -'aliases' => [ - // ... - 'Xml' => Bmatovu\LaravelXml\LaravelXml::class, -], +```bash +$ composer require bmatovu/laravel-xml ``` -If you cached your configurations, you need to run; - -`$ php artisan config:cache` - ### Requests Get the request content (body). @@ -66,15 +40,11 @@ $request->wantsXml(); Validate XML content ```php -use Xml; - Xml::is_valid($request->xml()); ``` **Validation** - Against XML Schema Definition ```php -use Xml; - $errors = Xml::validate($request->xml(), 'path_to/sample.xsd'); if ($errors) { @@ -154,8 +124,6 @@ In case of the request `content-type` is not xml, the response will be; **Encode: Array to Xml** ```php -use Xml; - Xml::encode(['key' => 'value']); ``` @@ -169,8 +137,6 @@ xml_encode(['key' => 'value']); **Decode: Xml to Array** ```php -use Xml; - Xml::decode('value'); ```