From 09071f4b53e6b719fce5f3cb90ba54de58bb58ee Mon Sep 17 00:00:00 2001 From: Amine Ben hammou Date: Wed, 23 Sep 2015 01:49:46 +0100 Subject: [PATCH] Starting ModelCommand --- .gitignore | 5 + README.md | 2 + composer.json | 21 + composer.lock | 2177 ++++++++++++++++++++ formats/fields.json | 0 src/Argument/ArgumentFormat.php | 43 + src/Argument/ArgumentFormatLoader.php | 142 ++ src/Argument/ArgumentParser.php | 114 + src/Commands/BaseCommand.php | 47 + src/Commands/ControllerCommand.php | 0 src/Commands/MigrationCommand.php | 0 src/Commands/ModelCommand.php | 51 + src/Commands/ResourceCommand.php | 0 src/Commands/RouteCommand.php | 0 src/Commands/SeedCommand.php | 0 src/Commands/TestCommand.php | 0 src/CommandsServiceProvider.php | 76 + src/Exceptions/ArgumentFormatException.php | 4 + src/Exceptions/ArgumentParserException.php | 4 + src/Exceptions/TemplateException.php | 4 + src/Template/Template.php | 60 + src/Template/TemplateLoader.php | 31 + templates/controller.wnt | 0 templates/migration.wnt | 22 + templates/migration/schema-field.wnt | 0 templates/model.wnt | 11 + templates/route.wnt | 0 templates/seed.wnt | 0 templates/test.wnt | 0 29 files changed, 2814 insertions(+) create mode 100644 .gitignore create mode 100644 composer.json create mode 100644 composer.lock create mode 100644 formats/fields.json create mode 100644 src/Argument/ArgumentFormat.php create mode 100644 src/Argument/ArgumentFormatLoader.php create mode 100644 src/Argument/ArgumentParser.php create mode 100644 src/Commands/BaseCommand.php create mode 100644 src/Commands/ControllerCommand.php create mode 100644 src/Commands/MigrationCommand.php create mode 100644 src/Commands/ModelCommand.php create mode 100644 src/Commands/ResourceCommand.php create mode 100644 src/Commands/RouteCommand.php create mode 100644 src/Commands/SeedCommand.php create mode 100644 src/Commands/TestCommand.php create mode 100644 src/CommandsServiceProvider.php create mode 100644 src/Exceptions/ArgumentFormatException.php create mode 100644 src/Exceptions/ArgumentParserException.php create mode 100644 src/Exceptions/TemplateException.php create mode 100644 src/Template/Template.php create mode 100644 src/Template/TemplateLoader.php create mode 100644 templates/controller.wnt create mode 100644 templates/migration.wnt create mode 100644 templates/migration/schema-field.wnt create mode 100644 templates/model.wnt create mode 100644 templates/route.wnt create mode 100644 templates/seed.wnt create mode 100644 templates/test.wnt diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7beb027 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +/vendor/ +/about/ +*.sublime-* + +tests/_output/* \ No newline at end of file diff --git a/README.md b/README.md index 39ae807..ca9a634 100644 --- a/README.md +++ b/README.md @@ -1 +1,3 @@ # lumen-rest-generators + +Restful resources generators for Lumen and Laravel 5. \ No newline at end of file diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..ae6044e --- /dev/null +++ b/composer.json @@ -0,0 +1,21 @@ +{ + "name": "wn/lumen-rest-generators", + "description": "Restful resources generators for Lumen and Laravel 5.", + "keywords": ["lumen", "laravel", "rest", "api", "generators"], + "license": "MIT", + "authors": [ + { + "name": "Amine Ben hammou", + "email": "webneat@gmail.com" + } + ], + "require": { + "php": ">=5.4.0", + "illuminate/console": "^5.1" + }, + "autoload": { + "psr-4": { + "Wn\\Generators\\": "src/" + } + } +} diff --git a/composer.lock b/composer.lock new file mode 100644 index 0000000..1a7c638 --- /dev/null +++ b/composer.lock @@ -0,0 +1,2177 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "This file is @generated automatically" + ], + "hash": "5f855d0c352aa09aa7663b6f497ced13", + "packages": [ + { + "name": "danielstjules/stringy", + "version": "1.10.0", + "source": { + "type": "git", + "url": "https://github.com/danielstjules/Stringy.git", + "reference": "4749c205db47ee5b32e8d1adf6d9aff8db6caf3b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/danielstjules/Stringy/zipball/4749c205db47ee5b32e8d1adf6d9aff8db6caf3b", + "reference": "4749c205db47ee5b32e8d1adf6d9aff8db6caf3b", + "shasum": "" + }, + "require": { + "ext-mbstring": "*", + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Stringy\\": "src/" + }, + "files": [ + "src/Create.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Daniel St. Jules", + "email": "danielst.jules@gmail.com", + "homepage": "http://www.danielstjules.com" + } + ], + "description": "A string manipulation library with multibyte support", + "homepage": "https://github.com/danielstjules/Stringy", + "keywords": [ + "UTF", + "helpers", + "manipulation", + "methods", + "multibyte", + "string", + "utf-8", + "utility", + "utils" + ], + "time": "2015-07-23 00:54:12" + }, + { + "name": "doctrine/inflector", + "version": "v1.0.1", + "source": { + "type": "git", + "url": "https://github.com/doctrine/inflector.git", + "reference": "0bcb2e79d8571787f18b7eb036ed3d004908e604" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/inflector/zipball/0bcb2e79d8571787f18b7eb036ed3d004908e604", + "reference": "0bcb2e79d8571787f18b7eb036ed3d004908e604", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "require-dev": { + "phpunit/phpunit": "4.*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-0": { + "Doctrine\\Common\\Inflector\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Common String Manipulations with regard to casing and singular/plural rules.", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "inflection", + "pluralize", + "singularize", + "string" + ], + "time": "2014-12-20 21:24:13" + }, + { + "name": "illuminate/console", + "version": "v5.1.16", + "source": { + "type": "git", + "url": "https://github.com/illuminate/console.git", + "reference": "1b63e829eba104077ed3a79160dfd11d5357e851" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/illuminate/console/zipball/1b63e829eba104077ed3a79160dfd11d5357e851", + "reference": "1b63e829eba104077ed3a79160dfd11d5357e851", + "shasum": "" + }, + "require": { + "illuminate/contracts": "5.1.*", + "illuminate/support": "5.1.*", + "nesbot/carbon": "~1.19", + "php": ">=5.5.9", + "symfony/console": "2.7.*" + }, + "suggest": { + "guzzlehttp/guzzle": "Required to use the thenPing method on schedules (~5.3|~6.0).", + "mtdowling/cron-expression": "Required to use scheduling component (~1.0).", + "symfony/process": "Required to use scheduling component (2.7.*)." + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.1-dev" + } + }, + "autoload": { + "psr-4": { + "Illuminate\\Console\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylorotwell@gmail.com" + } + ], + "description": "The Illuminate Console package.", + "homepage": "http://laravel.com", + "time": "2015-08-12 14:49:07" + }, + { + "name": "illuminate/contracts", + "version": "v5.1.16", + "source": { + "type": "git", + "url": "https://github.com/illuminate/contracts.git", + "reference": "610aea16e3d91dfd85db4cf43703403a83b7cba2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/illuminate/contracts/zipball/610aea16e3d91dfd85db4cf43703403a83b7cba2", + "reference": "610aea16e3d91dfd85db4cf43703403a83b7cba2", + "shasum": "" + }, + "require": { + "php": ">=5.5.9" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.1-dev" + } + }, + "autoload": { + "psr-4": { + "Illuminate\\Contracts\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylorotwell@gmail.com" + } + ], + "description": "The Illuminate Contracts package.", + "homepage": "http://laravel.com", + "time": "2015-08-31 12:59:22" + }, + { + "name": "illuminate/support", + "version": "v5.1.16", + "source": { + "type": "git", + "url": "https://github.com/illuminate/support.git", + "reference": "c5389968d48517b3b51cfd8cd4abd72f0cc1575b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/illuminate/support/zipball/c5389968d48517b3b51cfd8cd4abd72f0cc1575b", + "reference": "c5389968d48517b3b51cfd8cd4abd72f0cc1575b", + "shasum": "" + }, + "require": { + "danielstjules/stringy": "~1.8", + "doctrine/inflector": "~1.0", + "ext-mbstring": "*", + "illuminate/contracts": "5.1.*", + "php": ">=5.5.9" + }, + "suggest": { + "jeremeamia/superclosure": "Required to be able to serialize closures (~2.0).", + "symfony/var-dumper": "Required to use the dd function (2.7.*)." + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.1-dev" + } + }, + "autoload": { + "psr-4": { + "Illuminate\\Support\\": "" + }, + "files": [ + "helpers.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylorotwell@gmail.com" + } + ], + "description": "The Illuminate Support package.", + "homepage": "http://laravel.com", + "time": "2015-09-03 15:47:41" + }, + { + "name": "nesbot/carbon", + "version": "1.20.0", + "source": { + "type": "git", + "url": "https://github.com/briannesbitt/Carbon.git", + "reference": "bfd3eaba109c9a2405c92174c8e17f20c2b9caf3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/bfd3eaba109c9a2405c92174c8e17f20c2b9caf3", + "reference": "bfd3eaba109c9a2405c92174c8e17f20c2b9caf3", + "shasum": "" + }, + "require": { + "php": ">=5.3.0", + "symfony/translation": "~2.6|~3.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "type": "library", + "autoload": { + "psr-0": { + "Carbon": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Brian Nesbitt", + "email": "brian@nesbot.com", + "homepage": "http://nesbot.com" + } + ], + "description": "A simple API extension for DateTime.", + "homepage": "http://carbon.nesbot.com", + "keywords": [ + "date", + "datetime", + "time" + ], + "time": "2015-06-25 04:19:39" + }, + { + "name": "symfony/console", + "version": "v2.7.4", + "source": { + "type": "git", + "url": "https://github.com/symfony/Console.git", + "reference": "9ff9032151186bd66ecee727d728f1319f52d1d8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/Console/zipball/9ff9032151186bd66ecee727d728f1319f52d1d8", + "reference": "9ff9032151186bd66ecee727d728f1319f52d1d8", + "shasum": "" + }, + "require": { + "php": ">=5.3.9" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/event-dispatcher": "~2.1", + "symfony/phpunit-bridge": "~2.7", + "symfony/process": "~2.1" + }, + "suggest": { + "psr/log": "For using the console logger", + "symfony/event-dispatcher": "", + "symfony/process": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.7-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Console\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Console Component", + "homepage": "https://symfony.com", + "time": "2015-09-03 11:40:38" + }, + { + "name": "symfony/translation", + "version": "v2.7.4", + "source": { + "type": "git", + "url": "https://github.com/symfony/Translation.git", + "reference": "485877661835e188cd78345c6d4eef1290d17571" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/Translation/zipball/485877661835e188cd78345c6d4eef1290d17571", + "reference": "485877661835e188cd78345c6d4eef1290d17571", + "shasum": "" + }, + "require": { + "php": ">=5.3.9" + }, + "conflict": { + "symfony/config": "<2.7" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/config": "~2.7", + "symfony/intl": "~2.4", + "symfony/phpunit-bridge": "~2.7", + "symfony/yaml": "~2.2" + }, + "suggest": { + "psr/log": "To use logging capability in translator", + "symfony/config": "", + "symfony/yaml": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.7-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Translation\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Translation Component", + "homepage": "https://symfony.com", + "time": "2015-09-06 08:36:38" + } + ], + "packages-dev": [ + { + "name": "codeception/codeception", + "version": "2.1.2", + "source": { + "type": "git", + "url": "https://github.com/Codeception/Codeception.git", + "reference": "521adbb2ee34e9debdd8508a2c41ab2b5c2f042b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Codeception/Codeception/zipball/521adbb2ee34e9debdd8508a2c41ab2b5c2f042b", + "reference": "521adbb2ee34e9debdd8508a2c41ab2b5c2f042b", + "shasum": "" + }, + "require": { + "ext-json": "*", + "ext-mbstring": "*", + "facebook/webdriver": ">=1.0.1", + "guzzlehttp/guzzle": ">=4.0|<7.0", + "guzzlehttp/psr7": "~1.0", + "php": ">=5.4.0", + "phpunit/phpunit": "~4.8.0", + "symfony/browser-kit": "~2.4", + "symfony/console": "~2.4", + "symfony/css-selector": "~2.4", + "symfony/dom-crawler": "~2.4,!=2.4.5", + "symfony/event-dispatcher": "~2.4", + "symfony/finder": "~2.4", + "symfony/yaml": "~2.4" + }, + "require-dev": { + "codeception/specify": "~0.3", + "facebook/php-sdk-v4": "~4.0", + "flow/jsonpath": "~0.2", + "monolog/monolog": "~1.8", + "pda/pheanstalk": "~2.0", + "videlalvaro/php-amqplib": "~2.4" + }, + "suggest": { + "codeception/phpbuiltinserver": "Extension to start and stop PHP built-in web server for your tests", + "codeception/specify": "BDD-style code blocks", + "codeception/verify": "BDD-style assertions", + "monolog/monolog": "Log test steps", + "phpseclib/phpseclib": "Extension required to use the SFTP option in the FTP Module." + }, + "bin": [ + "codecept" + ], + "type": "library", + "extra": { + "branch-alias": [] + }, + "autoload": { + "psr-4": { + "Codeception\\": "src\\Codeception", + "Codeception\\Extension\\": "ext" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Bodnarchuk", + "email": "davert@mail.ua", + "homepage": "http://codegyre.com" + } + ], + "description": "BDD-style testing framework", + "homepage": "http://codeception.com/", + "keywords": [ + "BDD", + "TDD", + "acceptance testing", + "functional testing", + "unit testing" + ], + "time": "2015-08-09 13:48:55" + }, + { + "name": "doctrine/instantiator", + "version": "1.0.5", + "source": { + "type": "git", + "url": "https://github.com/doctrine/instantiator.git", + "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d", + "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d", + "shasum": "" + }, + "require": { + "php": ">=5.3,<8.0-DEV" + }, + "require-dev": { + "athletic/athletic": "~0.1.8", + "ext-pdo": "*", + "ext-phar": "*", + "phpunit/phpunit": "~4.0", + "squizlabs/php_codesniffer": "~2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com", + "homepage": "http://ocramius.github.com/" + } + ], + "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", + "homepage": "https://github.com/doctrine/instantiator", + "keywords": [ + "constructor", + "instantiate" + ], + "time": "2015-06-14 21:17:01" + }, + { + "name": "facebook/webdriver", + "version": "1.0.2", + "source": { + "type": "git", + "url": "https://github.com/facebook/php-webdriver.git", + "reference": "fe1bbbc5dde804d08a8593f1d9d0d3b05f5c84f5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/facebook/php-webdriver/zipball/fe1bbbc5dde804d08a8593f1d9d0d3b05f5c84f5", + "reference": "fe1bbbc5dde804d08a8593f1d9d0d3b05f5c84f5", + "shasum": "" + }, + "require": { + "php": ">=5.3.19" + }, + "require-dev": { + "phpunit/phpunit": "4.6.*" + }, + "suggest": { + "phpdocumentor/phpdocumentor": "2.*" + }, + "type": "library", + "autoload": { + "psr-4": { + "Facebook\\WebDriver\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "description": "A PHP client for WebDriver", + "homepage": "https://github.com/facebook/php-webdriver", + "keywords": [ + "facebook", + "php", + "selenium", + "webdriver" + ], + "time": "2015-08-12 20:21:31" + }, + { + "name": "guzzlehttp/guzzle", + "version": "6.1.0", + "source": { + "type": "git", + "url": "https://github.com/guzzle/guzzle.git", + "reference": "66fd14b4d0b8f2389eaf37c5458608c7cb793a81" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/66fd14b4d0b8f2389eaf37c5458608c7cb793a81", + "reference": "66fd14b4d0b8f2389eaf37c5458608c7cb793a81", + "shasum": "" + }, + "require": { + "guzzlehttp/promises": "~1.0", + "guzzlehttp/psr7": "~1.1", + "php": ">=5.5.0" + }, + "require-dev": { + "ext-curl": "*", + "phpunit/phpunit": "~4.0", + "psr/log": "~1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "6.1-dev" + } + }, + "autoload": { + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "GuzzleHttp\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Guzzle is a PHP HTTP client library", + "homepage": "http://guzzlephp.org/", + "keywords": [ + "client", + "curl", + "framework", + "http", + "http client", + "rest", + "web service" + ], + "time": "2015-09-08 17:36:26" + }, + { + "name": "guzzlehttp/promises", + "version": "1.0.2", + "source": { + "type": "git", + "url": "https://github.com/guzzle/promises.git", + "reference": "97fe7210def29451ec74923b27e552238defd75a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/promises/zipball/97fe7210def29451ec74923b27e552238defd75a", + "reference": "97fe7210def29451ec74923b27e552238defd75a", + "shasum": "" + }, + "require": { + "php": ">=5.5.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Promise\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Guzzle promises library", + "keywords": [ + "promise" + ], + "time": "2015-08-15 19:37:21" + }, + { + "name": "guzzlehttp/psr7", + "version": "1.2.0", + "source": { + "type": "git", + "url": "https://github.com/guzzle/psr7.git", + "reference": "4ef919b0cf3b1989523138b60163bbcb7ba1ff7e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/4ef919b0cf3b1989523138b60163bbcb7ba1ff7e", + "reference": "4ef919b0cf3b1989523138b60163bbcb7ba1ff7e", + "shasum": "" + }, + "require": { + "php": ">=5.4.0", + "psr/http-message": "~1.0" + }, + "provide": { + "psr/http-message-implementation": "1.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Psr7\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "PSR-7 message implementation", + "keywords": [ + "http", + "message", + "stream", + "uri" + ], + "time": "2015-08-15 19:32:36" + }, + { + "name": "phpdocumentor/reflection-docblock", + "version": "2.0.4", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", + "reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/d68dbdc53dc358a816f00b300704702b2eaff7b8", + "reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "suggest": { + "dflydev/markdown": "~1.0", + "erusev/parsedown": "~1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-0": { + "phpDocumentor": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "mike.vanriel@naenius.com" + } + ], + "time": "2015-02-03 12:10:50" + }, + { + "name": "phpspec/php-diff", + "version": "v1.0.2", + "source": { + "type": "git", + "url": "https://github.com/phpspec/php-diff.git", + "reference": "30e103d19519fe678ae64a60d77884ef3d71b28a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpspec/php-diff/zipball/30e103d19519fe678ae64a60d77884ef3d71b28a", + "reference": "30e103d19519fe678ae64a60d77884ef3d71b28a", + "shasum": "" + }, + "type": "library", + "autoload": { + "psr-0": { + "Diff": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Chris Boulton", + "homepage": "http://github.com/chrisboulton", + "role": "Original developer" + } + ], + "description": "A comprehensive library for generating differences between two hashable objects (strings or arrays).", + "time": "2013-11-01 13:02:21" + }, + { + "name": "phpspec/phpspec", + "version": "2.3.0", + "source": { + "type": "git", + "url": "https://github.com/phpspec/phpspec.git", + "reference": "36635a903bdeb54899d7407bc95610501fd98559" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpspec/phpspec/zipball/36635a903bdeb54899d7407bc95610501fd98559", + "reference": "36635a903bdeb54899d7407bc95610501fd98559", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.0.1", + "php": ">=5.3.3", + "phpspec/php-diff": "~1.0.0", + "phpspec/prophecy": "~1.4", + "sebastian/exporter": "~1.0", + "symfony/console": "~2.3", + "symfony/event-dispatcher": "~2.1", + "symfony/finder": "~2.1", + "symfony/process": "^2.6", + "symfony/yaml": "~2.1" + }, + "require-dev": { + "behat/behat": "^3.0.11", + "bossa/phpspec2-expect": "~1.0", + "phpunit/phpunit": "~4.4", + "symfony/filesystem": "~2.1" + }, + "suggest": { + "phpspec/nyan-formatters": "~1.0 – Adds Nyan formatters" + }, + "bin": [ + "bin/phpspec" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.2.x-dev" + } + }, + "autoload": { + "psr-0": { + "PhpSpec": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Konstantin Kudryashov", + "email": "ever.zet@gmail.com", + "homepage": "http://everzet.com" + }, + { + "name": "Marcello Duarte", + "homepage": "http://marcelloduarte.net/" + } + ], + "description": "Specification-oriented BDD framework for PHP 5.3+", + "homepage": "http://phpspec.net/", + "keywords": [ + "BDD", + "SpecBDD", + "TDD", + "spec", + "specification", + "testing", + "tests" + ], + "time": "2015-09-07 07:07:37" + }, + { + "name": "phpspec/prophecy", + "version": "v1.5.0", + "source": { + "type": "git", + "url": "https://github.com/phpspec/prophecy.git", + "reference": "4745ded9307786b730d7a60df5cb5a6c43cf95f7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/4745ded9307786b730d7a60df5cb5a6c43cf95f7", + "reference": "4745ded9307786b730d7a60df5cb5a6c43cf95f7", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.0.2", + "phpdocumentor/reflection-docblock": "~2.0", + "sebastian/comparator": "~1.1" + }, + "require-dev": { + "phpspec/phpspec": "~2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4.x-dev" + } + }, + "autoload": { + "psr-0": { + "Prophecy\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Konstantin Kudryashov", + "email": "ever.zet@gmail.com", + "homepage": "http://everzet.com" + }, + { + "name": "Marcello Duarte", + "email": "marcello.duarte@gmail.com" + } + ], + "description": "Highly opinionated mocking framework for PHP 5.3+", + "homepage": "https://github.com/phpspec/prophecy", + "keywords": [ + "Double", + "Dummy", + "fake", + "mock", + "spy", + "stub" + ], + "time": "2015-08-13 10:07:40" + }, + { + "name": "phpunit/php-code-coverage", + "version": "2.2.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-code-coverage.git", + "reference": "ef1ca6835468857944d5c3b48fa503d5554cff2f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/ef1ca6835468857944d5c3b48fa503d5554cff2f", + "reference": "ef1ca6835468857944d5c3b48fa503d5554cff2f", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "phpunit/php-file-iterator": "~1.3", + "phpunit/php-text-template": "~1.2", + "phpunit/php-token-stream": "~1.3", + "sebastian/environment": "^1.3.2", + "sebastian/version": "~1.0" + }, + "require-dev": { + "ext-xdebug": ">=2.1.4", + "phpunit/phpunit": "~4" + }, + "suggest": { + "ext-dom": "*", + "ext-xdebug": ">=2.2.1", + "ext-xmlwriter": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.2.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", + "homepage": "https://github.com/sebastianbergmann/php-code-coverage", + "keywords": [ + "coverage", + "testing", + "xunit" + ], + "time": "2015-09-14 06:51:16" + }, + { + "name": "phpunit/php-file-iterator", + "version": "1.4.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-file-iterator.git", + "reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/6150bf2c35d3fc379e50c7602b75caceaa39dbf0", + "reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "FilterIterator implementation that filters files based on a list of suffixes.", + "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", + "keywords": [ + "filesystem", + "iterator" + ], + "time": "2015-06-21 13:08:43" + }, + { + "name": "phpunit/php-text-template", + "version": "1.2.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-text-template.git", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Simple template engine.", + "homepage": "https://github.com/sebastianbergmann/php-text-template/", + "keywords": [ + "template" + ], + "time": "2015-06-21 13:50:34" + }, + { + "name": "phpunit/php-timer", + "version": "1.0.7", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-timer.git", + "reference": "3e82f4e9fc92665fafd9157568e4dcb01d014e5b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3e82f4e9fc92665fafd9157568e4dcb01d014e5b", + "reference": "3e82f4e9fc92665fafd9157568e4dcb01d014e5b", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Utility class for timing", + "homepage": "https://github.com/sebastianbergmann/php-timer/", + "keywords": [ + "timer" + ], + "time": "2015-06-21 08:01:12" + }, + { + "name": "phpunit/php-token-stream", + "version": "1.4.8", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-token-stream.git", + "reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da", + "reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Wrapper around PHP's tokenizer extension.", + "homepage": "https://github.com/sebastianbergmann/php-token-stream/", + "keywords": [ + "tokenizer" + ], + "time": "2015-09-15 10:49:45" + }, + { + "name": "phpunit/phpunit", + "version": "4.8.9", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit.git", + "reference": "73fad41adb5b7bc3a494bb930d90648df1d5e74b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/73fad41adb5b7bc3a494bb930d90648df1d5e74b", + "reference": "73fad41adb5b7bc3a494bb930d90648df1d5e74b", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-json": "*", + "ext-pcre": "*", + "ext-reflection": "*", + "ext-spl": "*", + "php": ">=5.3.3", + "phpspec/prophecy": "^1.3.1", + "phpunit/php-code-coverage": "~2.1", + "phpunit/php-file-iterator": "~1.4", + "phpunit/php-text-template": "~1.2", + "phpunit/php-timer": ">=1.0.6", + "phpunit/phpunit-mock-objects": "~2.3", + "sebastian/comparator": "~1.1", + "sebastian/diff": "~1.2", + "sebastian/environment": "~1.3", + "sebastian/exporter": "~1.2", + "sebastian/global-state": "~1.0", + "sebastian/version": "~1.0", + "symfony/yaml": "~2.1|~3.0" + }, + "suggest": { + "phpunit/php-invoker": "~1.1" + }, + "bin": [ + "phpunit" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.8.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "The PHP Unit Testing framework.", + "homepage": "https://phpunit.de/", + "keywords": [ + "phpunit", + "testing", + "xunit" + ], + "time": "2015-09-20 12:56:44" + }, + { + "name": "phpunit/phpunit-mock-objects", + "version": "2.3.7", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", + "reference": "5e2645ad49d196e020b85598d7c97e482725786a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/5e2645ad49d196e020b85598d7c97e482725786a", + "reference": "5e2645ad49d196e020b85598d7c97e482725786a", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.0.2", + "php": ">=5.3.3", + "phpunit/php-text-template": "~1.2", + "sebastian/exporter": "~1.2" + }, + "require-dev": { + "phpunit/phpunit": "~4.4" + }, + "suggest": { + "ext-soap": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.3.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Mock Object library for PHPUnit", + "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", + "keywords": [ + "mock", + "xunit" + ], + "time": "2015-08-19 09:14:08" + }, + { + "name": "psr/http-message", + "version": "1.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-message.git", + "reference": "85d63699f0dbedb190bbd4b0d2b9dc707ea4c298" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/85d63699f0dbedb190bbd4b0d2b9dc707ea4c298", + "reference": "85d63699f0dbedb190bbd4b0d2b9dc707ea4c298", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP messages", + "keywords": [ + "http", + "http-message", + "psr", + "psr-7", + "request", + "response" + ], + "time": "2015-05-04 20:22:00" + }, + { + "name": "sebastian/comparator", + "version": "1.2.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/comparator.git", + "reference": "937efb279bd37a375bcadf584dec0726f84dbf22" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/937efb279bd37a375bcadf584dec0726f84dbf22", + "reference": "937efb279bd37a375bcadf584dec0726f84dbf22", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "sebastian/diff": "~1.2", + "sebastian/exporter": "~1.2" + }, + "require-dev": { + "phpunit/phpunit": "~4.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides the functionality to compare PHP values for equality", + "homepage": "http://www.github.com/sebastianbergmann/comparator", + "keywords": [ + "comparator", + "compare", + "equality" + ], + "time": "2015-07-26 15:48:44" + }, + { + "name": "sebastian/diff", + "version": "1.3.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "863df9687835c62aa423a22412d26fa2ebde3fd3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/863df9687835c62aa423a22412d26fa2ebde3fd3", + "reference": "863df9687835c62aa423a22412d26fa2ebde3fd3", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Diff implementation", + "homepage": "http://www.github.com/sebastianbergmann/diff", + "keywords": [ + "diff" + ], + "time": "2015-02-22 15:13:53" + }, + { + "name": "sebastian/environment", + "version": "1.3.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/environment.git", + "reference": "6324c907ce7a52478eeeaede764f48733ef5ae44" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/6324c907ce7a52478eeeaede764f48733ef5ae44", + "reference": "6324c907ce7a52478eeeaede764f48733ef5ae44", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides functionality to handle HHVM/PHP environments", + "homepage": "http://www.github.com/sebastianbergmann/environment", + "keywords": [ + "Xdebug", + "environment", + "hhvm" + ], + "time": "2015-08-03 06:14:51" + }, + { + "name": "sebastian/exporter", + "version": "1.2.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/exporter.git", + "reference": "7ae5513327cb536431847bcc0c10edba2701064e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/7ae5513327cb536431847bcc0c10edba2701064e", + "reference": "7ae5513327cb536431847bcc0c10edba2701064e", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "sebastian/recursion-context": "~1.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides the functionality to export PHP variables for visualization", + "homepage": "http://www.github.com/sebastianbergmann/exporter", + "keywords": [ + "export", + "exporter" + ], + "time": "2015-06-21 07:55:53" + }, + { + "name": "sebastian/global-state", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/global-state.git", + "reference": "c7428acdb62ece0a45e6306f1ae85e1c05b09c01" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/c7428acdb62ece0a45e6306f1ae85e1c05b09c01", + "reference": "c7428acdb62ece0a45e6306f1ae85e1c05b09c01", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.2" + }, + "suggest": { + "ext-uopz": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Snapshotting of global state", + "homepage": "http://www.github.com/sebastianbergmann/global-state", + "keywords": [ + "global state" + ], + "time": "2014-10-06 09:23:50" + }, + { + "name": "sebastian/recursion-context", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/recursion-context.git", + "reference": "994d4a811bafe801fb06dccbee797863ba2792ba" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/994d4a811bafe801fb06dccbee797863ba2792ba", + "reference": "994d4a811bafe801fb06dccbee797863ba2792ba", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides functionality to recursively process PHP variables", + "homepage": "http://www.github.com/sebastianbergmann/recursion-context", + "time": "2015-06-21 08:04:50" + }, + { + "name": "sebastian/version", + "version": "1.0.6", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", + "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", + "shasum": "" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that helps with managing the version number of Git-hosted PHP projects", + "homepage": "https://github.com/sebastianbergmann/version", + "time": "2015-06-21 13:59:46" + }, + { + "name": "symfony/browser-kit", + "version": "v2.7.4", + "source": { + "type": "git", + "url": "https://github.com/symfony/BrowserKit.git", + "reference": "277a2457776d4cc25706fbdd9d1e4ab2dac884e4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/BrowserKit/zipball/277a2457776d4cc25706fbdd9d1e4ab2dac884e4", + "reference": "277a2457776d4cc25706fbdd9d1e4ab2dac884e4", + "shasum": "" + }, + "require": { + "php": ">=5.3.9", + "symfony/dom-crawler": "~2.0,>=2.0.5" + }, + "require-dev": { + "symfony/css-selector": "~2.0,>=2.0.5", + "symfony/phpunit-bridge": "~2.7", + "symfony/process": "~2.0,>=2.0.5" + }, + "suggest": { + "symfony/process": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.7-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\BrowserKit\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony BrowserKit Component", + "homepage": "https://symfony.com", + "time": "2015-09-06 08:36:38" + }, + { + "name": "symfony/css-selector", + "version": "v2.7.4", + "source": { + "type": "git", + "url": "https://github.com/symfony/CssSelector.git", + "reference": "ffb5f3b8a75f8d1b9801e74dc6789a0751a670ad" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/CssSelector/zipball/ffb5f3b8a75f8d1b9801e74dc6789a0751a670ad", + "reference": "ffb5f3b8a75f8d1b9801e74dc6789a0751a670ad", + "shasum": "" + }, + "require": { + "php": ">=5.3.9" + }, + "require-dev": { + "symfony/phpunit-bridge": "~2.7" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.7-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\CssSelector\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jean-François Simon", + "email": "jeanfrancois.simon@sensiolabs.com" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony CssSelector Component", + "homepage": "https://symfony.com", + "time": "2015-08-24 07:13:45" + }, + { + "name": "symfony/dom-crawler", + "version": "v2.7.4", + "source": { + "type": "git", + "url": "https://github.com/symfony/DomCrawler.git", + "reference": "2a161e4ee2b2f33d4153be58df4f6f2a5506936e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/DomCrawler/zipball/2a161e4ee2b2f33d4153be58df4f6f2a5506936e", + "reference": "2a161e4ee2b2f33d4153be58df4f6f2a5506936e", + "shasum": "" + }, + "require": { + "php": ">=5.3.9" + }, + "require-dev": { + "symfony/css-selector": "~2.3", + "symfony/phpunit-bridge": "~2.7" + }, + "suggest": { + "symfony/css-selector": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.7-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\DomCrawler\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony DomCrawler Component", + "homepage": "https://symfony.com", + "time": "2015-08-26 10:48:03" + }, + { + "name": "symfony/event-dispatcher", + "version": "v2.7.4", + "source": { + "type": "git", + "url": "https://github.com/symfony/EventDispatcher.git", + "reference": "b58c916f1db03a611b72dd702564f30ad8fe83fa" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/EventDispatcher/zipball/b58c916f1db03a611b72dd702564f30ad8fe83fa", + "reference": "b58c916f1db03a611b72dd702564f30ad8fe83fa", + "shasum": "" + }, + "require": { + "php": ">=5.3.9" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/config": "~2.0,>=2.0.5", + "symfony/dependency-injection": "~2.6", + "symfony/expression-language": "~2.6", + "symfony/phpunit-bridge": "~2.7", + "symfony/stopwatch": "~2.3" + }, + "suggest": { + "symfony/dependency-injection": "", + "symfony/http-kernel": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.7-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\EventDispatcher\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony EventDispatcher Component", + "homepage": "https://symfony.com", + "time": "2015-08-24 07:13:45" + }, + { + "name": "symfony/finder", + "version": "v2.7.4", + "source": { + "type": "git", + "url": "https://github.com/symfony/Finder.git", + "reference": "fff4b0c362640a0ab7355e2647b3d461608e9065" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/Finder/zipball/fff4b0c362640a0ab7355e2647b3d461608e9065", + "reference": "fff4b0c362640a0ab7355e2647b3d461608e9065", + "shasum": "" + }, + "require": { + "php": ">=5.3.9" + }, + "require-dev": { + "symfony/phpunit-bridge": "~2.7" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.7-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Finder\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Finder Component", + "homepage": "https://symfony.com", + "time": "2015-08-26 17:56:37" + }, + { + "name": "symfony/process", + "version": "v2.7.4", + "source": { + "type": "git", + "url": "https://github.com/symfony/Process.git", + "reference": "f7b3f73f70a7f8f49a1c838dc3debbf054732d8e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/Process/zipball/f7b3f73f70a7f8f49a1c838dc3debbf054732d8e", + "reference": "f7b3f73f70a7f8f49a1c838dc3debbf054732d8e", + "shasum": "" + }, + "require": { + "php": ">=5.3.9" + }, + "require-dev": { + "symfony/phpunit-bridge": "~2.7" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.7-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Process\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Process Component", + "homepage": "https://symfony.com", + "time": "2015-08-27 06:45:45" + }, + { + "name": "symfony/yaml", + "version": "v2.7.4", + "source": { + "type": "git", + "url": "https://github.com/symfony/Yaml.git", + "reference": "2dc7b06c065df96cc686c66da2705e5e18aef661" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/Yaml/zipball/2dc7b06c065df96cc686c66da2705e5e18aef661", + "reference": "2dc7b06c065df96cc686c66da2705e5e18aef661", + "shasum": "" + }, + "require": { + "php": ">=5.3.9" + }, + "require-dev": { + "symfony/phpunit-bridge": "~2.7" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.7-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Yaml\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Yaml Component", + "homepage": "https://symfony.com", + "time": "2015-08-24 07:13:45" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": ">=5.4.0" + }, + "platform-dev": [] +} diff --git a/formats/fields.json b/formats/fields.json new file mode 100644 index 0000000..e69de29 diff --git a/src/Argument/ArgumentFormat.php b/src/Argument/ArgumentFormat.php new file mode 100644 index 0000000..55b4f3a --- /dev/null +++ b/src/Argument/ArgumentFormat.php @@ -0,0 +1,43 @@ + Format, field_name => Format, ... ] + * Specify the format of an element of array + * + * @var mixed + */ + public $format; + +} \ No newline at end of file diff --git a/src/Argument/ArgumentFormatLoader.php b/src/Argument/ArgumentFormatLoader.php new file mode 100644 index 0000000..c3092a6 --- /dev/null +++ b/src/Argument/ArgumentFormatLoader.php @@ -0,0 +1,142 @@ +fs = $fs; + $this->loaded = []; + } + + public function load($name) + { + if(! isset($this->loaded[$name])){ + $path = __DIR__ . "/../../formats/{$name}.json"; + $json = ""; + try { + $json = json_decode($this->fs->get($path)); + } catch(\Exception $e) { + throw new ArgumentFormatException("Unable to read the file '{$path}'"); + } + if (json_last_error() !== JSON_ERROR_NONE){ + throw new ArgumentFormatException("Error while parsing the JSON file '{$path}'"); + } + $this->loaded[$name] = $this->buildFormat($json); + } + return $this->loaded[$name]; + } + + protected function buildFormat($obj) + { + return $this->fillFirstLevel($obj); + } + + protected function fillFirstLevel($obj) + { + return $this->fill($obj, true); + } + + protected function fill($obj, $firstLevel = false) + { + if (is_string($obj)) { + return $this->fillString($obj, $firstLevel); + } else { + return $this->fillObject($obj, $firstLevel); + } + } + + protected function fillString($string, $firstLevel = false) + { + list($name, $type, $isArray) = $this->parseName($string); + + $format = new ArgumentFormat; + $format->name = $name; + + if ($isArray) { + $format->type = 'array'; + $subFormat = new Format; + $subFormat->type = $type ?: 'string'; + $format->format = $subFormat; + } else { + $format->type = 'string'; + } + + if ($firstLevel) { + if ($format->type === 'object') { + $format->separator = ':'; + } elseif ($format->type === 'array') { + $format->separator = ','; + } + } + + return $format; + } + + protected function fillObject($obj, $firstLevel=false) + { + $format = new ArgumentFormat; + + // Resolve type from name + if (isset($obj->name)) { + list($name, $type) = $this->parseName($obj->name); + $format->name = $name; + $format->type = $type; + } + + // Fill type if set + if (isset($obj->type)) { + $format->type = $obj->type; + } + + // Fill default if set + if (isset($obj->default)) { + $format->default = $obj->default; + } + + // Set separator, default to ':' for objects and ',' for arrays in first level + if (in_array($format->type, ['object', 'array'])) { + if (isset($obj->separator)) { + $format->separator = $obj->separator; + } elseif ($firstLevel) { + $format->separator = ($format->type === 'object') ? ':':','; + } + } + + // Build format recursively + if (isset($obj->fields)) { + if ($firstLevel) { + if (is_array($obj->fields)) { + $format->format = array_map([$this, 'fillFirstLevel'], $obj->fields); + } else { + $format->format = $this->fill($obj->fields, true); + } + } else { + if (is_array($obj->fields)) { + $format->format = array_map([$this, 'fill'], $obj->fields); + } else { + $format->format = $this->fill($obj->fields); + } + } + } + + return $format; + } + + protected function parseName($name) + { + $pattern = '/^(?P\w+)(\[(?P\w+)?\])?/'; + preg_match($pattern, $name, $matches); + + $attr = $matches['attr']; + $type = empty($matches['type']) ? null : $matches['type']; + $isArray = (@$matches[2][0] === '['); + + return [$attr, $type, $isArray]; + } + +} \ No newline at end of file diff --git a/src/Argument/ArgumentParser.php b/src/Argument/ArgumentParser.php new file mode 100644 index 0000000..0077b7d --- /dev/null +++ b/src/Argument/ArgumentParser.php @@ -0,0 +1,114 @@ +format = $format; + } + + public function parse($args) + { + return $this->parseToken($args, $this->format); + } + + protected function parseToken($token, ArgumentFormat $format){ + switch($format->type) { + case 'string': + return $token; + case 'number': + return $this->parseNumber($token); + case 'boolean': + return $this->parseBoolean($token, $format->name); + case 'array': + return $this->parseArray($token, $format->separator, $format->format); + case 'object': + return $this->parseObject($token, $format->separator, $format->format); + default: + throw new ArgumentParserException("Unknown format type: '{$format->type}'"); + } + } + + protected function parseNumber($token) + { + if(! is_numeric($token)) { + throw new ArgumentParserException("Unable to parse '{$token}' as number"); + } + return $token + 0; + } + + protected function parseBoolean($token, $name) + { + if(in_array($token, ['yes', 'true', '1', $name])) { + return true; + } else if(in_array($token, ['no', 'false', '0', "!{$name}"])){ + return false; + } else { + return null; + } + } + + protected function parseArray($token, $separator, Format $format) + { + $result = []; + $tokens = explode($separator, $token); + foreach($tokens as $value) { + array_push($result, $this->parseToken($value, $format)); + } + return $result; + } + + protected function parseObject($token, $separator, $fields) + { + $result = []; + $tokens = explode($separator, $token); + $tokensNumber = count($tokens); + + $requiredFieldsIndexes = []; + $optionalFieldsIndexes = []; + foreach($fields as $index => $format) { + if($format->default === null) { + array_push($requiredFieldsIndexes, $index); + } else { + array_push($optionalFieldsIndexes, $index); + } + } + $requiredFieldsIndexesNumber = count($requiredFieldsIndexes); + + if($tokensNumber < $requiredFieldsIndexesNumber) { + $requiredFields = array_map(function($index) use ($fields) { + return $fields[$index]->name; + }, $requiredFieldsIndexes); + $requiredFields = implode($separator, $requiredFields); + throw new ArgumentParserException("Required field missing: {$tokensNumber} given " + . "({$token}) but {$requiredFieldsIndexesNumber} required ({$requiredFields})"); + } + + $givenOptionalFieldsIndexes = array_slice( + $optionalFieldsIndexes, 0, $tokensNumber - $requiredFieldsIndexesNumber); + $notPresentFieldsIndexes = array_slice( + $optionalFieldsIndexes, $tokensNumber - $requiredFieldsIndexesNumber); + $givenFieldsIndexes = array_merge($requiredFieldsIndexes, $givenOptionalFieldsIndexes); + sort($givenFieldsIndexes); + + // Fill the given fields + for($i = 0; $i < $tokensNumber; $i ++) { + $fieldFormat = $fields[$givenFieldsIndexes[$i]]; + $result[$fieldFormat->name] = $this->parseToken($tokens[$i], $fieldFormat); + } + + // Fill other fields with default values + foreach($notPresentFieldsIndexes as $index) { + $fieldFormat = $fields[$index]; + $result[$fieldFormat->name] = $fieldFormat->default; + } + + return $result; + } + +} \ No newline at end of file diff --git a/src/Commands/BaseCommand.php b/src/Commands/BaseCommand.php new file mode 100644 index 0000000..17609cc --- /dev/null +++ b/src/Commands/BaseCommand.php @@ -0,0 +1,47 @@ +fs = $fs; + $this->templates = new TemplateLoader($fs); + $this->argumentFormatLoader = new ArgumentFormatLoader($fs); + } + + protected function getTemplate($name) + { + return $this->templates->load($name); + } + + protected function getArgumentParser($name){ + $format = $this->argumentFormatLoader->load($name); + return new ArgumentParser($format); + } + + protected function save($content, $path) + { + $this->makeDirectory($path); + $this->fs->put($path, $content); + } + + protected function makeDirectory($path) + { + if (!$this->fs->isDirectory(dirname($path))) { + $this->fs->makeDirectory(dirname($path), 0777, true, true); + } + } + +} \ No newline at end of file diff --git a/src/Commands/ControllerCommand.php b/src/Commands/ControllerCommand.php new file mode 100644 index 0000000..e69de29 diff --git a/src/Commands/MigrationCommand.php b/src/Commands/MigrationCommand.php new file mode 100644 index 0000000..e69de29 diff --git a/src/Commands/ModelCommand.php b/src/Commands/ModelCommand.php new file mode 100644 index 0000000..25caa62 --- /dev/null +++ b/src/Commands/ModelCommand.php @@ -0,0 +1,51 @@ +argument('name'); + $path = $this->option('path'); + + $content = $this->getTemplate('model') + ->with([ + 'name' => $name, + 'namespace' => $this->getNamespace(), + 'fillable' => $this->getAsArrayFields('fillable'), + 'dates' => $this->getAsArrayFields('dates') + ]) + ->get(); + + $this->save($content, "./{$path}/{$name}.php"); + + $this->info("Model {$name} Generated !"); + } + + protected function getAsArrayFields($arg, $isOption = true) + { + $arg = ($isOption) ? $this->option($arg) : $this->argument($arg); + if(is_string($arg)){ + $arg = explode(',', $arg); + } + return implode(', ', array_map(function($item){ + return '"' . $item . '"'; + }, $arg)); + } + + protected function getNamespace() + { + return str_replace(' ', '\\', ucwords(str_replace('/', ' ', $this->option('path')))); + } + +} \ No newline at end of file diff --git a/src/Commands/ResourceCommand.php b/src/Commands/ResourceCommand.php new file mode 100644 index 0000000..e69de29 diff --git a/src/Commands/RouteCommand.php b/src/Commands/RouteCommand.php new file mode 100644 index 0000000..e69de29 diff --git a/src/Commands/SeedCommand.php b/src/Commands/SeedCommand.php new file mode 100644 index 0000000..e69de29 diff --git a/src/Commands/TestCommand.php b/src/Commands/TestCommand.php new file mode 100644 index 0000000..e69de29 diff --git a/src/CommandsServiceProvider.php b/src/CommandsServiceProvider.php new file mode 100644 index 0000000..789bdff --- /dev/null +++ b/src/CommandsServiceProvider.php @@ -0,0 +1,76 @@ +register + $this->registerModelCommand(); + // $this->registerControllerCommand(); + // $this->registerMigrationCommand(); + // $this->registerSeedCommand(); + // $this->registerRouteCommand(); + // $this->registerTestCommand(); + // $this->registerResourceCommand(); + } + + protected function registerModelCommand(){ + $this->app->singleton('command.wn.model', function($app){ + return $app['Wn\Generators\Commands\ModelCommand']; + }); + $this->commands('command.wn.model'); + + } + + protected function registerControllerCommand(){ + $this->app->singleton('command.wn.controller', function($app){ + return $app['Wn\Generators\Commands\ControllerCommand']; + }); + $this->commands('command.wn.controller'); + + } + + protected function registerMigrationCommand(){ + $this->app->singleton('command.wn.migration', function($app){ + return $app['Wn\Generators\Commands\MigrationCommand']; + }); + $this->commands('command.wn.migration'); + + } + + protected function registerSeedCommand(){ + $this->app->singleton('command.wn.seed', function($app){ + return $app['Wn\Generators\Commands\SeedCommand']; + }); + $this->commands('command.wn.seed'); + + } + + protected function registerRouteCommand(){ + $this->app->singleton('command.wn.route', function($app){ + return $app['Wn\Generators\Commands\RouteCommand']; + }); + $this->commands('command.wn.route'); + + } + + protected function registerTestCommand(){ + $this->app->singleton('command.wn.test', function($app){ + return $app['Wn\Generators\Commands\TestCommand']; + }); + $this->commands('command.wn.test'); + + } + + protected function registerResourceCommand(){ + $this->app->singleton('command.wn.resource', function($app){ + return $app['Wn\Generators\Commands\ResourceCommand']; + }); + $this->commands('command.wn.resource'); + + } + +} diff --git a/src/Exceptions/ArgumentFormatException.php b/src/Exceptions/ArgumentFormatException.php new file mode 100644 index 0000000..03b845e --- /dev/null +++ b/src/Exceptions/ArgumentFormatException.php @@ -0,0 +1,4 @@ +loader = $loader; + $this->text = $text; + $this->compiled = ''; + $this->data = []; + $this->dirty = false; + } + + public function clean() + { + $this->data = []; + $this->dirty = false; + return $this; + } + + public function with($data = []) + { + if($data) + $this->dirty = true; + foreach ($data as $key => $value) { + $this->data[$key] = $value; + } + return $this; + } + + public function get() + { + if($this->dirty){ + $this->compile(); + $this->dirty = false; + } + return $this->compiled; + } + + public function compile() + { + $this->compiled = $this->text; + foreach($this->data as $key => $value){ + $this->compiled = str_replace('{{' . $key . '}}', $value, $this->compiled); + } + return $this; + } + +} \ No newline at end of file diff --git a/src/Template/TemplateLoader.php b/src/Template/TemplateLoader.php new file mode 100644 index 0000000..ecb4003 --- /dev/null +++ b/src/Template/TemplateLoader.php @@ -0,0 +1,31 @@ +fs = $fs; + $this->loaded = []; + } + + public function load($name) + { + if(! isset($this->loaded[$name])){ + $path = __DIR__ . "/../../templates/{$name}.wnt"; + try { + $this->loaded[$name] = $this->fs->get($path); + } catch(\Exception $e) { + throw new TemplateException("Unable to read the file '{$path}'"); + } + } + return new Template($this, $this->loaded[$name]); + } + +} \ No newline at end of file diff --git a/templates/controller.wnt b/templates/controller.wnt new file mode 100644 index 0000000..e69de29 diff --git a/templates/migration.wnt b/templates/migration.wnt new file mode 100644 index 0000000..5d32e09 --- /dev/null +++ b/templates/migration.wnt @@ -0,0 +1,22 @@ +increments('id'); +{{fields}} + $table->timestamps(); + }); + } + + public function down() + { + Schema::drop('{{table}}'); + } +} diff --git a/templates/migration/schema-field.wnt b/templates/migration/schema-field.wnt new file mode 100644 index 0000000..e69de29 diff --git a/templates/model.wnt b/templates/model.wnt new file mode 100644 index 0000000..d78d180 --- /dev/null +++ b/templates/model.wnt @@ -0,0 +1,11 @@ +