From 126030f147f4d111bcaa9f59b1fcf062fdb67abb Mon Sep 17 00:00:00 2001 From: Bruno Date: Thu, 12 Dec 2019 16:01:22 -0300 Subject: [PATCH] version 1.0 --- .gitignore | 5 +- README.md | 11 ++- composer.json | 13 +-- composer.lock | 252 ++++++++++++++++++++++++++++++++++++++++++++++++++ index.php | 6 +- post.php | 6 +- 6 files changed, 272 insertions(+), 21 deletions(-) create mode 100644 composer.lock diff --git a/.gitignore b/.gitignore index e731025..2e4fe16 100644 --- a/.gitignore +++ b/.gitignore @@ -441,12 +441,9 @@ gradle-app.setting ##### Composer composer.phar +composer.dev.json /vendor/ -# Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-control -# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file -composer.lock - ##### PHP CodeSniffer # gitignore for the PHP Codesniffer framework # website: https://github.com/squizlabs/PHP_CodeSniffer diff --git a/README.md b/README.md index f0c0133..9905bc9 100644 --- a/README.md +++ b/README.md @@ -2,11 +2,18 @@ A simple pure PHP app showing how to use [Formularium](https://github.com/Corollarium/Formularium). +## How to run + +- clone repo locally +- run `composer install` +- run `php -S localhost:8080` +- open http://localhost:8080 in your browser + ## About -This is a minimum simple example of how to use Formularium, using plain PHP without any PHP frameworks. It uses [Bootstrap](https://getbootstrap.com/) for styling. +This is a minimum simple example of how to use Formularium, using plain PHP without any PHP frameworks. It uses [Bootstrap](https://getbootstrap.com/) for styling. It only uses the browser validation. We do not validate the `aaaaa` field with a pattern on purpose so you can submit and see the backend validation too. -- [index.php](https://github.com/Corollarium/Formularium-example/blob/master/index.php): Renders a form. This is your C in CRUD. +- [index.php](https://github.com/Corollarium/Formularium-example/blob/master/index.php): Renders a form. - [model.php](https://github.com/Corollarium/Formularium-example/blob/master/model.php): The object model, with all its fields. - [post.php](https://github.com/Corollarium/Formularium-example/blob/master/post.php): The post form action. Only validates and renders the output. - [Datatype_aaaaa.php](https://github.com/Corollarium/Formularium-example/blob/master/Datatype_aaaaa.php): A custom datatype. In this case it is a field that requires you to diff --git a/composer.json b/composer.json index bd20dc2..b2113a2 100644 --- a/composer.json +++ b/composer.json @@ -7,17 +7,8 @@ "homepage": "https://github.com/Corollarium/FormulariumApp", "require": { "php": ">=7.1.0", - "corollarium/formularium": "@dev" + "corollarium/formularium": "^0.1.0" }, - "repositories": [ - { - "type": "path", - "url": "../formularium/", - "options": { - "symlink": true - } - } - ], "scripts": { } -} \ No newline at end of file +} diff --git a/composer.lock b/composer.lock new file mode 100644 index 0000000..11a7e51 --- /dev/null +++ b/composer.lock @@ -0,0 +1,252 @@ +{ + "_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#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "8cdf4a61ff9512b52639cafd993dc674", + "packages": [ + { + "name": "corollarium/formularium", + "version": "0.1.0", + "source": { + "type": "git", + "url": "https://github.com/Corollarium/Formularium.git", + "reference": "0c219f72c56096f70cefbe06814235678acf7de8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Corollarium/Formularium/zipball/0c219f72c56096f70cefbe06814235678acf7de8", + "reference": "0c219f72c56096f70cefbe06814235678acf7de8", + "shasum": "" + }, + "require": { + "fzaninotto/faker": "^1.9", + "php": ">=7.1.0", + "respect/validation": "^1.1" + }, + "require-dev": { + "phpstan/phpstan": "^0.12.2", + "phpunit/phpunit": "^7", + "symplify/easy-coding-standard": "^6.1" + }, + "type": "library", + "autoload": { + "psr-4": { + "Formularium\\": "Formularium/" + } + }, + "scripts": { + "make:datatype": [ + "bash ./util/makeDatatype.sh" + ], + "make:framework": [ + "bash ./util/makeFramework.sh" + ], + "makeKitchenSink": [ + "php ./util/makeKitchenSink.php" + ], + "format": [ + "vendor/bin/ecs check Formularium/ --level clean-code --fix && vendor/bin/ecs check Formularium/ --level psr12 --fix" + ], + "stan": [ + "vendor/bin/phpstan analyse Formularium" + ], + "coverage": [ + "mkdir build 2> /dev/null && ./vendor/bin/phpunit --bootstrap vendor/autoload.php --whitelist Formularium --coverage-html build/coverage-report tests/" + ], + "test": [ + "./vendor/bin/phpunit --bootstrap vendor/autoload.php tests/" + ] + }, + "license": [ + "MIT" + ], + "description": "Form validation and generation for PHP with custom frontend generators", + "homepage": "https://github.com/Corollarium/Formularium", + "keywords": [ + "form" + ] + }, + { + "name": "fzaninotto/faker", + "version": "v1.9.0", + "source": { + "type": "git", + "url": "https://github.com/fzaninotto/Faker.git", + "reference": "27a216cbe72327b2d6369fab721a5843be71e57d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/fzaninotto/Faker/zipball/27a216cbe72327b2d6369fab721a5843be71e57d", + "reference": "27a216cbe72327b2d6369fab721a5843be71e57d", + "shasum": "" + }, + "require": { + "php": "^5.3.3 || ^7.0" + }, + "require-dev": { + "ext-intl": "*", + "phpunit/phpunit": "^4.8.35 || ^5.7", + "squizlabs/php_codesniffer": "^2.9.2" + }, + "type": "library", + "extra": { + "branch-alias": [] + }, + "autoload": { + "psr-4": { + "Faker\\": "src/Faker/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "François Zaninotto" + } + ], + "description": "Faker is a PHP library that generates fake data for you.", + "keywords": [ + "data", + "faker", + "fixtures" + ], + "time": "2019-11-14T13:13:06+00:00" + }, + { + "name": "respect/validation", + "version": "1.1.31", + "source": { + "type": "git", + "url": "https://github.com/Respect/Validation.git", + "reference": "45d109fc830644fecc1145200d6351ce4f2769d0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Respect/Validation/zipball/45d109fc830644fecc1145200d6351ce4f2769d0", + "reference": "45d109fc830644fecc1145200d6351ce4f2769d0", + "shasum": "" + }, + "require": { + "php": ">=5.4", + "symfony/polyfill-mbstring": "^1.2" + }, + "require-dev": { + "egulias/email-validator": "~1.2 || ~2.1", + "mikey179/vfsstream": "^1.5", + "phpunit/phpunit": "~4.0 || ~5.0", + "symfony/validator": "~2.6.9", + "zendframework/zend-validator": "~2.3" + }, + "suggest": { + "egulias/email-validator": "Strict (RFC compliant) email validation", + "ext-bcmath": "Arbitrary Precision Mathematics", + "ext-mbstring": "Multibyte String Functions", + "friendsofphp/php-cs-fixer": "Fix PSR2 and other coding style issues", + "symfony/validator": "Use Symfony validator through Respect\\Validation", + "zendframework/zend-validator": "Use Zend Framework validator through Respect\\Validation" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "psr-4": { + "Respect\\Validation\\": "library/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Respect/Validation Contributors", + "homepage": "https://github.com/Respect/Validation/graphs/contributors" + } + ], + "description": "The most awesome validation engine ever created for PHP", + "homepage": "http://respect.github.io/Validation/", + "keywords": [ + "respect", + "validation", + "validator" + ], + "time": "2019-05-28T06:10:06+00:00" + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.13.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "7b4aab9743c30be783b73de055d24a39cf4b954f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/7b4aab9743c30be783b73de055d24a39cf4b954f", + "reference": "7b4aab9743c30be783b73de055d24a39cf4b954f", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.13-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "time": "2019-11-27T14:18:11+00:00" + } + ], + "packages-dev": [], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": ">=7.1.0" + }, + "platform-dev": [] +} diff --git a/index.php b/index.php index 65b7552..42ed29f 100644 --- a/index.php +++ b/index.php @@ -30,8 +30,10 @@ ?> -