diff --git a/CHANGELOG.md b/CHANGELOG.md index 470c9176bf3..f713ff51bb1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,27 @@ # CHANGELOG +## 3.0.0 (2016-06-28) + +- [Read the migration documentation](https://docs.zendframework.com/tutorials/migration/to-v3/overview/). +- [Read the recommended quick start](https://docs.zendframework.com/tutorials/getting-started/overview/) +- Marks the package as a Composer metapackage; this means the package itself + will not be installed, only the requirements it defines. +- Updates the minimum supported PHP version to 5.6. +- Updates all components to latest versions, including v3 releases where + present. Also adds the following components: + - zend-mvc-console + - zend-mvc-plugins + - zend-mvc-form + - zend-mvc-i18n + - zend-json-server + - zend-xml2json + - zend-diactoros + - zend-stratigility + - zend-psr7bridge + - zend-hydrator + - zend-servicemanager-di +- Removes all `bin/*` scripts. + ## 2.5.3 (2016-01-27) - [#7665](https://github.com/zendframework/zf2/pull/7665) updates component version constraints from `~2.5.0` to `^2.5` to ensure the latest security updates are always installed. diff --git a/CONDUCT.md b/CONDUCT.md new file mode 100644 index 00000000000..c663d2be930 --- /dev/null +++ b/CONDUCT.md @@ -0,0 +1,43 @@ +# Contributor Code of Conduct + +The Zend Framework project adheres to [The Code Manifesto](http://codemanifesto.com) +as its guidelines for contributor interactions. + +## The Code Manifesto + +We want to work in an ecosystem that empowers developers to reach their +potential — one that encourages growth and effective collaboration. A space that +is safe for all. + +A space such as this benefits everyone that participates in it. It encourages +new developers to enter our field. It is through discussion and collaboration +that we grow, and through growth that we improve. + +In the effort to create such a place, we hold to these values: + +1. **Discrimination limits us.** This includes discrimination on the basis of + race, gender, sexual orientation, gender identity, age, nationality, technology + and any other arbitrary exclusion of a group of people. +2. **Boundaries honor us.** Your comfort levels are not everyone’s comfort + levels. Remember that, and if brought to your attention, heed it. +3. **We are our biggest assets.** None of us were born masters of our trade. + Each of us has been helped along the way. Return that favor, when and where + you can. +4. **We are resources for the future.** As an extension of #3, share what you + know. Make yourself a resource to help those that come after you. +5. **Respect defines us.** Treat others as you wish to be treated. Make your + discussions, criticisms and debates from a position of respectfulness. Ask + yourself, is it true? Is it necessary? Is it constructive? Anything less is + unacceptable. +6. **Reactions require grace.** Angry responses are valid, but abusive language + and vindictive actions are toxic. When something happens that offends you, + handle it assertively, but be respectful. Escalate reasonably, and try to + allow the offender an opportunity to explain themselves, and possibly correct + the issue. +7. **Opinions are just that: opinions.** Each and every one of us, due to our + background and upbringing, have varying opinions. The fact of the matter, is + that is perfectly acceptable. Remember this: if you respect your own + opinions, you should respect the opinions of others. +8. **To err is human.** You might not intend it, but mistakes do happen and + contribute to build experience. Tolerate honest mistakes, and don't hesitate + to apologize if you make one yourself. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 52437a79977..1718ba9c8ee 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -5,19 +5,17 @@ If you wish to contribute to Zend Framework, please be sure to read/subscribe to the following resources: - - [Coding Standards](https://github.com/zendframework/zf2/wiki/Coding-Standards) - - [Contributor's Guide](http://framework.zend.com/participate/contributor-guide) - - ZF Contributor's mailing list: - Archives: http://zend-framework-community.634137.n4.nabble.com/ZF-Contributor-f680267.html - Subscribe: zf-contributors-subscribe@lists.zend.com - - ZF Contributor's IRC channel: - #zftalk.dev on Freenode.net + - [Coding Standards](https://github.com/zendframework/zendframework/wiki/Coding-Standards) + - [Contributor's Guide](http://framework.zend.com/participate/contributor-guide) + - ZF Contributor's IRC channel: #zftalk.dev on Freenode.net + - [Code of Conduct](http://github.com/zendframework/zendframework/blob/master/CONDUCT.md) -If you are working on new features or refactoring [create a proposal](https://github.com/zendframework/zf2/issues/new). +If you are working on new features or refactoring, please create an issue +detailing the changes on the relevant component repository, as linked below. ## Components -This package is primarily a meta-package, declaring a host of ZF components as +This package is a meta-package, declaring a host of ZF components as dependencies. These are listed below, with links to each repository; most issues and pull requests rightfully belong against the individual components and should be made accordingly. @@ -33,6 +31,7 @@ be made accordingly. - [zend-db](https://github.com/zendframework/zend-db) - [zend-debug](https://github.com/zendframework/zend-debug) - [zend-di](https://github.com/zendframework/zend-di) +- [zend-diactoros](https://github.com/zendframework/zend-diactoros) - [zend-dom](https://github.com/zendframework/zend-dom) - [zend-escaper](https://github.com/zendframework/zend-escaper) - [zend-eventmanager](https://github.com/zendframework/zend-eventmanager) @@ -41,10 +40,12 @@ be made accordingly. - [zend-filter](https://github.com/zendframework/zend-filter) - [zend-form](https://github.com/zendframework/zend-form) - [zend-http](https://github.com/zendframework/zend-http) +- [zend-hydrator](https://github.com/zendframework/zend-hydrator) - [zend-i18n](https://github.com/zendframework/zend-i18n) +- [zend-i18n-resources](https://github.com/zendframework/zend-i18n-resources) - [zend-inputfilter](https://github.com/zendframework/zend-inputfilter) - [zend-json](https://github.com/zendframework/zend-json) -- [zend-ldap](https://github.com/zendframework/zend-ldap) +- [zend-json-server](https://github.com/zendframework/zend-json-server) - [zend-loader](https://github.com/zendframework/zend-loader) - [zend-log](https://github.com/zendframework/zend-log) - [zend-mail](https://github.com/zendframework/zend-mail) @@ -53,32 +54,40 @@ be made accordingly. - [zend-mime](https://github.com/zendframework/zend-mime) - [zend-modulemanager](https://github.com/zendframework/zend-modulemanager) - [zend-mvc](https://github.com/zendframework/zend-mvc) +- [zend-mvc-console](https://github.com/zendframework/zend-mvc-console) +- [zend-mvc-form](https://github.com/zendframework/zend-mvc-form) +- [zend-mvc-i18n](https://github.com/zendframework/zend-mvc-i18n) +- [zend-mvc-plugins](https://github.com/zendframework/zend-mvc-plugins) - [zend-navigation](https://github.com/zendframework/zend-navigation) - [zend-paginator](https://github.com/zendframework/zend-paginator) - [zend-permissions-acl](https://github.com/zendframework/zend-permissions-acl) - [zend-permissions-rbac](https://github.com/zendframework/zend-permissions-rbac) - [zend-progressbar](https://github.com/zendframework/zend-progressbar) +- [zend-psr7bridge](https://github.com/zendframework/zend-psr7bridge) - [zend-serializer](https://github.com/zendframework/zend-serializer) - [zend-server](https://github.com/zendframework/zend-server) - [zend-servicemanager](https://github.com/zendframework/zend-servicemanager) +- [zend-servicemanager-di](https://github.com/zendframework/zend-servicemanager-di) - [zend-session](https://github.com/zendframework/zend-session) - [zend-soap](https://github.com/zendframework/zend-soap) - [zend-stdlib](https://github.com/zendframework/zend-stdlib) +- [zend-stratigility](https://github.com/zendframework/zend-stratigility) - [zend-tag](https://github.com/zendframework/zend-tag) - [zend-test](https://github.com/zendframework/zend-test) - [zend-text](https://github.com/zendframework/zend-text) - [zend-uri](https://github.com/zendframework/zend-uri) - [zend-validator](https://github.com/zendframework/zend-validator) -- [zend-version](https://github.com/zendframework/zend-version) - [zend-view](https://github.com/zendframework/zend-view) +- [zend-xml2json](https://github.com/zendframework/zend-xml2json) - [zend-xmlrpc](https://github.com/zendframework/zend-xmlrpc) -- [ZendXml](https://github.com/zendframework/ZendXml) +- [zendxml](https://github.com/zendframework/zendxml) ## Reporting Potential Security Issues -If you have encountered a potential security vulnerability, please **DO NOT** report it on the public -issue tracker: send it to us at [zf-security@zend.com](mailto:zf-security@zend.com) instead. -We will work with you to verify the vulnerability and patch it as soon as possible. +If you have encountered a potential security vulnerability, please **DO NOT** +report it on public issue trackers; instead, send it to us at +[zf-security@zend.com](mailto:zf-security@zend.com) instead. We will work with +you to verify the vulnerability and patch it as soon as possible. When reporting issues, please provide the following information: @@ -100,19 +109,19 @@ pull your work into the master repository. We recommend using [GitHub](https://github.com), as that is where the component is already hosted. 1. Setup a [GitHub account](http://github.com/), if you haven't yet -2. Fork the repository (http://github.com/zendframework/zf2) +2. Fork the relevant repository 3. Clone the canonical repository locally and enter it. ```console - $ git clone git://github.com:zendframework/zf2.git - $ cd zf2 + $ git clone git://github.com/zendframework/{component}.git + $ cd {component} ``` 4. Add a remote to your fork; substitute your GitHub username in the command below. ```console - $ git remote add {username} git@github.com:{username}/zf2.git + $ git remote add {username} git@github.com:{username}/{component}.git $ git fetch {username} ``` diff --git a/README.md b/README.md index bfb3d77b6e8..3c7c97be6b9 100644 --- a/README.md +++ b/README.md @@ -1,42 +1,68 @@ ![Logo](https://raw.githubusercontent.com/zendframework/zf2/234b554f2ca202095aea32e4fa557553f8849664/resources/ZendFramework-logo.png) -# Welcome to the *Zend Framework 2.6* Release! +# Welcome to the *Zend Framework 3.0* Release! ## RELEASE INFORMATION -*Zend Framework 2.6.0dev* +*Zend Framework 3.0.0dev* -This is the sixth minor (feature) release for the version 2 series. +This is the third major release for Zend Framework. DD MMM YYYY -### UPDATES IN 2.6.0 +### UPDATES IN 3.0.0 Please see [CHANGELOG.md](CHANGELOG.md). ### SYSTEM REQUIREMENTS -Zend Framework 2 requires PHP 5.5 or later; we recommend using the +Zend Framework 3 requires PHP 5.6 or later; we recommend using the latest PHP version whenever possible. ### INSTALLATION +We no longer recommend installing this package directly. The package is a +metapackage that aggregates all components (and/or integrations) originally +shipped with Zend Framework; in most cases, you will want a subset, and these +may be installed separately; see https://docs.zendframework.com/ for a list of +available packages and installation instructions for each. + +We recommend using either the zend-mvc skeleton application: + +```bash +$ composer create-project zendframework/skeleton-application project +``` + +or the Expressive skeleton application: + +```bash +$ composer create-project zendframework/zend-expressive-skeleton project +``` + +The primary use case for installing the entire framework is when upgrading from +a version 2 release. + +If you decide you still want to install the entire framework: + ```console $ composer require zendframework/zendframework ``` #### GETTING STARTED -A great place to get up-to-speed quickly is the Zend Framework -QuickStart: - -http://framework.zend.com/manual/current/en/user-guide/overview.html +A great place to get up-to-speed quickly is the [Zend Framework +QuickStart](https://docs.zendframework.com/tutorials/getting-started/overview/). The QuickStart covers some of the most commonly used components of ZF. Since Zend Framework is designed with a use-at-will architecture and components are loosely coupled, you can select and use only those components that are needed for your project. +#### MIGRATION + +For detailed information on migration from v2 to v3, please [read our Migration +Guide](https://docs.zendframework.com/tutorials/migration/to-v3/overview/). + ### COMPONENTS This package is a metapackage aggregating the following components: @@ -52,6 +78,7 @@ This package is a metapackage aggregating the following components: - [zend-db](https://github.com/zendframework/zend-db) - [zend-debug](https://github.com/zendframework/zend-debug) - [zend-di](https://github.com/zendframework/zend-di) +- [zend-diactoros](https://github.com/zendframework/zend-diactoros) - [zend-dom](https://github.com/zendframework/zend-dom) - [zend-escaper](https://github.com/zendframework/zend-escaper) - [zend-eventmanager](https://github.com/zendframework/zend-eventmanager) @@ -60,10 +87,12 @@ This package is a metapackage aggregating the following components: - [zend-filter](https://github.com/zendframework/zend-filter) - [zend-form](https://github.com/zendframework/zend-form) - [zend-http](https://github.com/zendframework/zend-http) +- [zend-hydrator](https://github.com/zendframework/zend-hydrator) - [zend-i18n](https://github.com/zendframework/zend-i18n) +- [zend-i18n-resources](https://github.com/zendframework/zend-i18n-resources) - [zend-inputfilter](https://github.com/zendframework/zend-inputfilter) - [zend-json](https://github.com/zendframework/zend-json) -- [zend-ldap](https://github.com/zendframework/zend-ldap) +- [zend-json-server](https://github.com/zendframework/zend-json-server) - [zend-loader](https://github.com/zendframework/zend-loader) - [zend-log](https://github.com/zendframework/zend-log) - [zend-mail](https://github.com/zendframework/zend-mail) @@ -72,53 +101,54 @@ This package is a metapackage aggregating the following components: - [zend-mime](https://github.com/zendframework/zend-mime) - [zend-modulemanager](https://github.com/zendframework/zend-modulemanager) - [zend-mvc](https://github.com/zendframework/zend-mvc) +- [zend-mvc-console](https://github.com/zendframework/zend-mvc-console) +- [zend-mvc-form](https://github.com/zendframework/zend-mvc-form) +- [zend-mvc-i18n](https://github.com/zendframework/zend-mvc-i18n) +- [zend-mvc-plugins](https://github.com/zendframework/zend-mvc-plugins) - [zend-navigation](https://github.com/zendframework/zend-navigation) - [zend-paginator](https://github.com/zendframework/zend-paginator) - [zend-permissions-acl](https://github.com/zendframework/zend-permissions-acl) - [zend-permissions-rbac](https://github.com/zendframework/zend-permissions-rbac) - [zend-progressbar](https://github.com/zendframework/zend-progressbar) +- [zend-psr7bridge](https://github.com/zendframework/zend-psr7bridge) - [zend-serializer](https://github.com/zendframework/zend-serializer) - [zend-server](https://github.com/zendframework/zend-server) - [zend-servicemanager](https://github.com/zendframework/zend-servicemanager) +- [zend-servicemanager-di](https://github.com/zendframework/zend-servicemanager-di) - [zend-session](https://github.com/zendframework/zend-session) - [zend-soap](https://github.com/zendframework/zend-soap) - [zend-stdlib](https://github.com/zendframework/zend-stdlib) +- [zend-stratigility](https://github.com/zendframework/zend-stratigility) - [zend-tag](https://github.com/zendframework/zend-tag) - [zend-test](https://github.com/zendframework/zend-test) - [zend-text](https://github.com/zendframework/zend-text) - [zend-uri](https://github.com/zendframework/zend-uri) - [zend-validator](https://github.com/zendframework/zend-validator) -- [zend-version](https://github.com/zendframework/zend-version) - [zend-view](https://github.com/zendframework/zend-view) +- [zend-xml2json](https://github.com/zendframework/zend-xml2json) - [zend-xmlrpc](https://github.com/zendframework/zend-xmlrpc) -- [ZendXml](https://github.com/zendframework/ZendXml) +- [zendxml](https://github.com/zendframework/zendxml) ### CONTRIBUTING If you wish to contribute to Zend Framework, please read the -[CONTRIBUTING.md](CONTRIBUTING.md) file. +[CONTRIBUTING.md](CONTRIBUTING.md) and [CONDUCT.md](CONDUCT.md) files. ### QUESTIONS AND FEEDBACK -Online documentation can be found at http://framework.zend.com/manual. +Online documentation can be found at https://docs.zendframework.com/. Questions that are not addressed in the manual should be directed to the -appropriate mailing list: - -http://framework.zend.com/archives/subscribe/ +relevant repository, as linked above. If you find code in this release behaving in an unexpected manner or -contrary to its documented behavior, please create an issue in our GitHub -issue tracker: - -https://github.com/zendframework/zf2/issues - -If you would like to be notified of new releases, you can subscribe to -the fw-announce mailing list by sending a blank message to -. +contrary to its documented behavior, please create an issue with the relevant +repository, as linked above. ## Reporting Potential Security Issues -If you have encountered a potential security vulnerability in Zend Framework, please report it to us at [zf-security@zend.com](mailto:zf-security@zend.com). We will work with you to verify the vulnerability and patch it. +If you have encountered a potential security vulnerability in Zend Framework, +please report it to us at [zf-security@zend.com](mailto:zf-security@zend.com). +We will work with you to verify the vulnerability and patch it. When reporting issues, please provide the following information: @@ -126,9 +156,14 @@ When reporting issues, please provide the following information: - A description indicating how to reproduce the issue - A summary of the security vulnerability and impact -We request that you contact us via the email address above and give the project contributors a chance to resolve the vulnerability and issue a new release prior to any public exposure; this helps protect Zend Framework users and provides them with a chance to upgrade and/or update in order to protect their applications. +We request that you contact us via the email address above and give the project +contributors a chance to resolve the vulnerability and issue a new release prior +to any public exposure; this helps protect Zend Framework users and provides +them with a chance to upgrade and/or update in order to protect their +applications. -For sensitive email communications, please use [our PGP key](http://framework.zend.com/zf-security-pgp-key.asc). +For sensitive email communications, please use +[our PGP key](http://framework.zend.com/zf-security-pgp-key.asc). ### LICENSE @@ -137,6 +172,9 @@ You can find a copy of this license in [LICENSE.md](LICENSE.md). ### ACKNOWLEDGEMENTS -The Zend Framework team would like to thank all the [contributors](https://github.com/zendframework/zf2/contributors) to the Zend -Framework project, our corporate sponsor, and you, the Zend Framework user. +The Zend Framework team would like to thank all the +[contributors](https://github.com/zendframework/zendframework/contributors) to +the Zend Framework project; our corporate sponsor, Zend Technologies / Rogue +Wave Software; and you, the Zend Framework user. + Please visit us sometime soon at http://framework.zend.com. diff --git a/bin/classmap_generator.php b/bin/classmap_generator.php deleted file mode 100755 index 551048c82a4..00000000000 --- a/bin/classmap_generator.php +++ /dev/null @@ -1,244 +0,0 @@ -#!/usr/bin/env php - ] Library to parse; if none provided, assumes - * current directory - * --output|-o [ ] Where to write autoload file; if not provided, - * assumes "autoload_classmap.php" in library directory - * --append|-a Append to autoload file if it exists - * --overwrite|-w Whether or not to overwrite existing autoload - * file - * --ignore|-i [ ] Comma-separated namespaces to ignore - * --sort|-s Alphabetically sort classes - */ - -// Setup/verify autoloading -if (file_exists(__DIR__ . '/../vendor/autoload.php')) { - // Local install - require __DIR__ . '/../vendor/autoload.php'; -} elseif (file_exists(getcwd() . '/vendor/autoload.php')) { - // Root project is current working directory - require getcwd() . '/vendor/autoload.php'; -} elseif (file_exists(__DIR__ . '/../../../autoload.php')) { - // Relative to composer install - require __DIR__ . '/../../../autoload.php'; -} else { - fwrite(STDERR, "Unable to setup autoloading; aborting\n"); - exit(2); -} - -$libraryPath = getcwd(); - -$rules = array( - 'help|h' => 'Get usage message', - 'library|l-s' => 'Library to parse; if none provided, assumes current directory', - 'output|o-s' => 'Where to write autoload file; if not provided, assumes "autoload_classmap.php" in library directory', - 'append|a' => 'Append to autoload file if it exists', - 'overwrite|w' => 'Whether or not to overwrite existing autoload file', - 'ignore|i-s' => 'Comma-separated namespaces to ignore', - 'sort|s' => 'Alphabetically sort classes', -); - -try { - $opts = new Console\Getopt($rules); - $opts->parse(); -} catch (Console\Exception\RuntimeException $e) { - echo $e->getUsageMessage(); - exit(2); -} - -if ($opts->getOption('h')) { - echo $opts->getUsageMessage(); - exit(0); -} - -$ignoreNamespaces = array(); -if (isset($opts->i)) { - $ignoreNamespaces = explode(',', $opts->i); -} - -$relativePathForClassmap = ''; -if (isset($opts->l)) { - if (!is_dir($opts->l)) { - echo 'Invalid library directory provided' . PHP_EOL - . PHP_EOL; - echo $opts->getUsageMessage(); - exit(2); - } - $libraryPath = $opts->l; -} -$libraryPath = str_replace(DIRECTORY_SEPARATOR, '/', realpath($libraryPath)); - -$usingStdout = false; -$appending = $opts->getOption('a'); -$output = $libraryPath . '/autoload_classmap.php'; -if (isset($opts->o)) { - $output = $opts->o; - if ('-' == $output) { - $output = STDOUT; - $usingStdout = true; - } elseif (is_dir($output)) { - echo 'Invalid output file provided' . PHP_EOL - . PHP_EOL; - echo $opts->getUsageMessage(); - exit(2); - } elseif (!is_writeable(dirname($output))) { - echo "Cannot write to '$output'; aborting." . PHP_EOL - . PHP_EOL - . $opts->getUsageMessage(); - exit(2); - } elseif (file_exists($output) && !$opts->getOption('w') && !$appending) { - echo "Autoload file already exists at '$output'," . PHP_EOL - . "but 'overwrite' or 'appending' flag was not specified; aborting." . PHP_EOL - . PHP_EOL - . $opts->getUsageMessage(); - exit(2); - } else { - // We need to add the $libraryPath into the relative path that is created in the classmap file. - $classmapPath = str_replace(DIRECTORY_SEPARATOR, '/', realpath(dirname($output))); - - // Simple case: $libraryPathCompare is in $classmapPathCompare - if (strpos($libraryPath, $classmapPath) === 0) { - $relativePathForClassmap = substr($libraryPath, strlen($classmapPath) + 1) . '/'; - } else { - $libraryPathParts = explode('/', $libraryPath); - $classmapPathParts = explode('/', $classmapPath); - - // Find the common part - $count = count($classmapPathParts); - for ($i = 0; $i < $count; $i++) { - if (!isset($libraryPathParts[$i]) || $libraryPathParts[$i] != $classmapPathParts[$i]) { - // Common part end - break; - } - } - - // Add parent dirs for the subdirs of classmap - $relativePathForClassmap = str_repeat('../', $count - $i); - - // Add library subdirs - $count = count($libraryPathParts); - for (; $i < $count; $i++) { - $relativePathForClassmap .= $libraryPathParts[$i] . '/'; - } - } - } -} - -if (!$usingStdout) { - if ($appending) { - echo "Appending to class file map '$output' for library in '$libraryPath'..." . PHP_EOL; - } else { - echo "Creating class file map for library in '$libraryPath'..." . PHP_EOL; - } -} - -// Get the ClassFileLocator, and pass it the library path -$l = new ClassFileLocator($libraryPath); - -// Iterate over each element in the path, and create a map of -// classname => filename, where the filename is relative to the library path -$map = new stdClass; -foreach ($l as $file) { - $filename = str_replace($libraryPath . '/', '', str_replace(DIRECTORY_SEPARATOR, '/', $file->getPath()) . '/' . $file->getFilename()); - - // Add in relative path to library - $filename = $relativePathForClassmap . $filename; - - foreach ($file->getClasses() as $class) { - foreach ($ignoreNamespaces as $ignoreNs) { - if ($ignoreNs == substr($class, 0, strlen($ignoreNs))) { - continue 2; - } - } - - $map->{$class} = $filename; - } -} - -$map = (array) $map; -if ($opts->getOption('s')) { - ksort($map); -} - -if ($appending) { - $content = var_export($map, true) . ';'; - - // Prefix with __DIR__; modify the generated content - $content = preg_replace("#(=> ')#", "=> __DIR__ . '/", $content); - - // Fix \' strings from injected DIRECTORY_SEPARATOR usage in iterator_apply op - $content = str_replace("\\'", "'", $content); - - // Convert to an array and remove the first "array(" - $content = explode("\n", $content); - array_shift($content); - - // Load existing class map file and remove the closing "bracket ");" from it - $existing = file($output, FILE_IGNORE_NEW_LINES); - array_pop($existing); - - // Merge - $content = implode("\n", array_merge($existing, $content)); -} else { - // Create a file with the class/file map. - // Stupid syntax highlighters make separating < from PHP declaration necessary - $content = '<' . "?php\n" - . "// Generated by ZF2's ./bin/classmap_generator.php\n" - . 'return ' . var_export($map, true) . ';'; - - // Prefix with __DIR__; modify the generated content - $content = preg_replace("#(=> ')#", "=> __DIR__ . '/", $content); - - // Fix \' strings from injected DIRECTORY_SEPARATOR usage in iterator_apply op - $content = str_replace("\\'", "'", $content); -} - -// Remove unnecessary double-backslashes -$content = str_replace('\\\\', '\\', $content); - -// Exchange "array (" width "array(" -$content = str_replace('array (', 'array(', $content); - -// Identing array content -$content = preg_replace('(\n )', "\n ", $content); - -// Align "=>" operators to match coding standard -preg_match_all('(\n\s+([^=]+)=>)', $content, $matches, PREG_SET_ORDER); -$maxWidth = 0; - -foreach ($matches as $match) { - $maxWidth = max($maxWidth, strlen($match[1])); -} - -$content = preg_replace_callback('(\n\s+([^=]+)=>)', function ($matches) { - global $maxWidth; - - return str_replace(' =>', str_repeat(' ', $maxWidth - strlen($matches[1])) . ' =>', $matches[0]); -}, $content); - -// Make the file end by EOL -$content = rtrim($content, "\n") . "\n"; - -// Write the contents to disk -file_put_contents($output, $content); - -if (!$usingStdout) { - echo "Wrote classmap file to '" . realpath($output) . "'" . PHP_EOL; -} diff --git a/bin/pluginmap_generator.php b/bin/pluginmap_generator.php deleted file mode 100755 index 8b73a60218f..00000000000 --- a/bin/pluginmap_generator.php +++ /dev/null @@ -1,189 +0,0 @@ -#!/usr/bin/env php - ] Library to parse; if none provided, assumes - * current directory - * --output|-o [ ] Where to write autoload file; if not provided, - * assumes "autoload_classmap.php" in library directory - * --append|-a Append to autoload file if it exists - * --overwrite|-w Whether or not to overwrite existing autoload - * file - */ - -// Setup/verify autoloading -if (file_exists(__DIR__ . '/../vendor/autoload.php')) { - // Local install - require __DIR__ . '/../vendor/autoload.php'; -} elseif (file_exists(getcwd() . '/vendor/autoload.php')) { - // Root project is current working directory - require getcwd() . '/vendor/autoload.php'; -} elseif (file_exists(__DIR__ . '/../../../autoload.php')) { - // Relative to composer install - require __DIR__ . '/../../../autoload.php'; -} else { - fwrite(STDERR, "Unable to setup autoloading; aborting\n"); - exit(2); -} - -$libPath = getenv('LIB_PATH') ? getenv('LIB_PATH') : __DIR__ . '/../library'; -if (!is_dir($libPath)) { - // Try to load StandardAutoloader from include_path - if (false === (include 'Zend/Loader/StandardAutoloader.php')) { - echo "Unable to locate autoloader via include_path; aborting" . PHP_EOL; - exit(2); - } -} else { - // Try to load StandardAutoloader from library - if (false === (include $libPath . '/Zend/Loader/StandardAutoloader.php')) { - echo "Unable to locate autoloader via library; aborting" . PHP_EOL; - exit(2); - } -} - -$rules = array( - 'help|h' => 'Get usage message', - 'library|l-s' => 'Library to parse; if none provided, assumes current directory', - 'output|o-s' => 'Where to write plugin map file; if not provided, assumes "plugin_classmap.php" in library directory', - 'append|a' => 'Append to plugin map file if it exists', - 'overwrite|w' => 'Whether or not to overwrite existing autoload file', -); - -try { - $opts = new Console\Getopt($rules); - $opts->parse(); -} catch (Console\Exception\RuntimeException $e) { - echo $e->getUsageMessage(); - exit(2); -} - -if ($opts->getOption('h')) { - echo $opts->getUsageMessage(); - exit(); -} - -$path = $libPath; -if (array_key_exists('PWD', $_SERVER)) { - $path = $_SERVER['PWD']; -} - -if (isset($opts->l)) { - $libraryPath = $opts->l; - $libraryPath = rtrim($libraryPath, '/\\') . DIRECTORY_SEPARATOR; - if (!is_dir($libraryPath)) { - echo "Invalid library directory provided" . PHP_EOL . PHP_EOL; - echo $opts->getUsageMessage(); - exit(2); - } - $path = realpath($libraryPath); -} - -$usingStdout = false; -$appending = $opts->getOption('a'); -$output = $path . DIRECTORY_SEPARATOR . 'plugin_classmap.php'; -if (isset($opts->o)) { - $output = $opts->o; - if ('-' == $output) { - $output = STDOUT; - $usingStdout = true; - } elseif (!is_writeable(dirname($output))) { - echo "Cannot write to '$output'; aborting." . PHP_EOL - . PHP_EOL - . $opts->getUsageMessage(); - exit(2); - } elseif (file_exists($output)) { - if (!$opts->getOption('w') && !$appending) { - echo "Plugin map file already exists at '$output'," . PHP_EOL - . "but 'overwrite' flag was not specified; aborting." . PHP_EOL - . PHP_EOL - . $opts->getUsageMessage(); - exit(2); - } - } -} - -if (!$usingStdout) { - if ($appending) { - echo "Appending to plugin class map '$output' for classes in '$path'..." . PHP_EOL; - } else { - echo "Creating plugin class map for classes in '$path'..." . PHP_EOL; - } -} - -// Get the ClassFileLocator, and pass it the library path -$l = new \Zend\File\ClassFileLocator($path); - -// Iterate over each element in the path, and create a map of pluginname => classname -$map = new \stdClass; -foreach ($l as $file) { - $namespaces = $file->getNamespaces(); - $namespace = empty($file->namespace) ? '' : $file->namespace . '\\'; - - foreach ($file->getClasses() as $classname) { - $plugin = $classname; - foreach ($namespaces as $namespace) { - $namespace .= '\\'; - if (0 === strpos($plugin, $namespace)) { - $plugin = str_replace($namespace, '', $plugin); - } - } - $plugin = strtolower($plugin); - $map->{$plugin} = $classname; - } -} - -if ($appending) { - $content = var_export((array) $map, true) . ';'; - - // Fix \' strings from injected DIRECTORY_SEPARATOR usage in iterator_apply op - $content = str_replace("\\'", "'", $content); - - // Convert to an array and remove the first "array (" - $content = explode("\n", $content); - array_shift($content); - - // Load existing class map file and remove the closing "bracket ");" from it - $existing = file($output, FILE_IGNORE_NEW_LINES); - array_pop($existing); - - // Merge - $content = implode("\n", $existing + $content); -} else { - // Create a file with the class/file map. - // Stupid syntax highlighters make separating < from PHP declaration necessary - $content = '<' . "?php\n\n" - . "// plugin class map\n" - . "// auto-generated using " - . basename($_SERVER['argv'][0]) . ', ' . date('Y-m-d H:i:s') . "\n\n" - . 'return ' . var_export((array) $map, true) . ';'; - - // Fix \' strings from injected DIRECTORY_SEPARATOR usage in iterator_apply op - $content = str_replace("\\'", "'", $content); -} - -// Make the file end by EOL -$content = rtrim($content, "\n") . "\n"; - -// Write the contents to disk -file_put_contents($output, $content); - -if (!$usingStdout) { - echo "Wrote plugin classmap file to '" . realpath($output) . "'" . PHP_EOL; -} diff --git a/bin/templatemap_generator.php b/bin/templatemap_generator.php deleted file mode 100755 index 8acd7b0ac9d..00000000000 --- a/bin/templatemap_generator.php +++ /dev/null @@ -1,256 +0,0 @@ -#!/usr/bin/env php - ] Library to parse; if none provided, assumes - * current directory - * --view|-v [ ] View path to parse; if none provided, assumes - * view as template directory - * --extensions|-e [ ] List of accepted file extensions (regex alternation - * without parenthesis); default: * - * --output|-o [ ] Where to write map file; if not provided, - * assumes "template_map.php" in library directory - * --append|-a Append to map file if it exists - * --overwrite|-w Whether or not to overwrite existing map file - */ - -// Setup/verify autoloading -if (file_exists(__DIR__ . '/../vendor/autoload.php')) { - // Local install - require __DIR__ . '/../vendor/autoload.php'; -} elseif (file_exists(getcwd() . '/vendor/autoload.php')) { - // Root project is current working directory - require getcwd() . '/vendor/autoload.php'; -} elseif (file_exists(__DIR__ . '/../../../autoload.php')) { - // Relative to composer install - require __DIR__ . '/../../../autoload.php'; -} else { - fwrite(STDERR, "Unable to setup autoloading; aborting\n"); - exit(2); -} - -$libraryPath = getcwd(); -$viewPath = getcwd() . '/view'; - -$rules = array( - 'help|h' => 'Get usage message', - 'library|l-s' => 'Library to parse; if none provided, assumes current directory', - 'view|v-s' => 'View path to parse; if none provided, assumes view as template directory', - 'extensions|e-s' => 'List of accepted file extensions (regex alternation: *html, phtml|tpl); default: *', - 'output|o-s' => 'Where to write map file; if not provided, assumes "template_map.php" in library directory', - 'append|a' => 'Append to map file if it exists', - 'overwrite|w' => 'Whether or not to overwrite existing map file', -); - -try { - $opts = new Console\Getopt($rules); - $opts->parse(); -} catch (Console\Exception\RuntimeException $e) { - echo $e->getUsageMessage(); - exit(2); -} - -if ($opts->getOption('h')) { - echo $opts->getUsageMessage(); - exit(0); -} - -$fileExtensions = '*'; -if (isset($opts->e) && $opts->e != '*') { - if (!preg_match('/^(\*?[[:alnum:]]\*?+\|?)+$/', $opts->e)) { - echo 'Invalid extensions list specified. Expecting wildcard or alternation: *, *html, phtml|tpl' . PHP_EOL - . PHP_EOL; - echo $opts->getUsageMessage(); - exit(2); - } - $fileExtensions = '(' . $opts->e . ')'; -} -$fileExtensions = str_replace('*', '.*', $fileExtensions); - -$relativePathForMap = ''; -if (isset($opts->l)) { - if (!is_dir($opts->l)) { - echo 'Invalid library directory provided' . PHP_EOL - . PHP_EOL; - echo $opts->getUsageMessage(); - exit(2); - } - $libraryPath = $opts->l; -} -$libraryPath = str_replace(DIRECTORY_SEPARATOR, '/', realpath($libraryPath)); - -if (isset($opts->v)) { - if (!is_dir($opts->v)) { - echo 'Invalid view template directory provided' . PHP_EOL - . PHP_EOL; - echo $opts->getUsageMessage(); - exit(2); - } - $viewPath = $opts->v; -} - -if (!is_dir($viewPath)) { - printf('Invalid view path provided (%s)', $viewPath); - echo PHP_EOL . PHP_EOL; - echo $opts->getUsageMessage(); - exit(2); -} - -$viewPath = str_replace(DIRECTORY_SEPARATOR, '/', realpath($viewPath)); - -$usingStdout = false; -$appending = $opts->getOption('a'); -$output = $libraryPath . '/template_map.php'; -if (isset($opts->o)) { - $output = $opts->o; - if ('-' == $output) { - $output = STDOUT; - $usingStdout = true; - } elseif (is_dir($output)) { - echo 'Invalid output file provided' . PHP_EOL - . PHP_EOL; - echo $opts->getUsageMessage(); - exit(2); - } elseif (!is_writeable(dirname($output))) { - echo "Cannot write to '$output'; aborting." . PHP_EOL - . PHP_EOL - . $opts->getUsageMessage(); - exit(2); - } elseif (file_exists($output) && !$opts->getOption('w') && !$appending) { - echo "Template map file already exists at '$output'," . PHP_EOL - . "but 'overwrite' or 'appending' flag was not specified; aborting." . PHP_EOL - . PHP_EOL - . $opts->getUsageMessage(); - exit(2); - } else { - // We need to add the $libraryPath into the relative path that is created in the template map file. - $mapPath = str_replace(DIRECTORY_SEPARATOR, '/', realpath(dirname($output))); - - // Simple case: $libraryPathCompare is in $mapPathCompare - if (strpos($libraryPath, $mapPath) === 0) { - $relativePathForMap = substr($libraryPath, strlen($mapPath) + 1) . '/'; - } else { - $libraryPathParts = explode('/', $libraryPath); - $mapPathParts = explode('/', $mapPath); - - // Find the common part - $count = count($mapPathParts); - for ($i = 0; $i < $count; $i++) { - if (!isset($libraryPathParts[$i]) || $libraryPathParts[$i] != $mapPathParts[$i]) { - // Common part end - break; - } - } - - // Add parent dirs for the subdirs of map - $relativePathForMap = str_repeat('../', $count - $i); - - // Add library subdirs - $count = count($libraryPathParts); - for (; $i < $count; $i++) { - $relativePathForMap .= $libraryPathParts[$i] . '/'; - } - } - } -} - -if (!$usingStdout) { - if ($appending) { - echo "Appending to template file map '$output' for library in '$libraryPath'..." . PHP_EOL; - } else { - echo "Creating template file map for library in '$libraryPath'..." . PHP_EOL; - } -} - -$dirOrIterator = new RecursiveDirectoryIterator($viewPath, RecursiveDirectoryIterator::FOLLOW_SYMLINKS); -$l = new RecursiveIteratorIterator($dirOrIterator); - -// Iterate over each element in the path, and create a map of -// template name => filename, where the filename is relative to the view path -$map = new stdClass; -foreach ($l as $file) { - /* @var $file SplFileInfo */ - if (!$file->isFile() || !preg_match('/^' . $fileExtensions . '$/', $file->getExtension())) { - continue; - } - $filename = str_replace($libraryPath . '/', '', str_replace(DIRECTORY_SEPARATOR, '/', $file->getPath()) . '/' . $file->getFilename()); - - // Add in relative path to library - $filename = $relativePathForMap . $filename; - $baseName = $file->getBasename('.' . pathinfo($file->getFilename(), PATHINFO_EXTENSION)); - $mapName = str_replace(str_replace(DIRECTORY_SEPARATOR, '/', realpath($viewPath)) . '/', '', str_replace(DIRECTORY_SEPARATOR, '/', $file->getPath()) . '/' . $baseName); - $map->{$mapName} = $filename; -} - -// Create a file with the map. - -if ($appending && file_exists($output) && is_array(include $output)) { - // Append mode and the output file already exists: retrieve its - // content and merges with the new map - // Remove the last line as it is the end of the array, and we want to - // append our new templates - $content = file($output, FILE_IGNORE_NEW_LINES); - array_pop($content); - $content = implode(PHP_EOL, $content) . PHP_EOL; -} else { - // Write mode or the file does not exists: create a new file - // Stupid syntax highlighters make separating < from PHP declaration necessary - $content = '<' . "?php" . PHP_EOL - . '// Generated by ZF2\'s ./bin/templatemap_generator.php' . PHP_EOL - . 'return array(' . PHP_EOL; -} - -// Process the template map as a string before inserting it to the output file - -$mapExport = var_export((array) $map, true); - -// Prefix with __DIR__ -$mapExport = preg_replace("#(=> ')#", "=> __DIR__ . '/", $mapExport); - -// Fix \' strings from injected DIRECTORY_SEPARATOR usage in iterator_apply op -$mapExport = str_replace("\\'", "'", $mapExport); - -// Remove unnecessary double-backslashes -$mapExport = str_replace('\\\\', '\\', $mapExport); - -// Remove "array (" -$mapExport = str_replace('array (', '', $mapExport); - -// Align "=>" operators to match coding standard -preg_match_all('(\n\s+([^=]+)=>)', $mapExport, $matches, PREG_SET_ORDER); -$maxWidth = 0; - -foreach ($matches as $match) { - $maxWidth = max($maxWidth, strlen($match[1])); -} - -$mapExport = preg_replace_callback('(\n\s+([^=]+)=>)', function ($matches) use ($maxWidth) { - return PHP_EOL . ' ' . $matches[1] . str_repeat(' ', $maxWidth - strlen($matches[1])) . '=>'; -}, $mapExport); - -// Trim the content -$mapExport = trim($mapExport, "\n"); - -// Append the map to the file, close the array and write a new line -$content .= $mapExport . ';' . PHP_EOL; - -// Write the contents to disk -file_put_contents($output, $content); - -if (!$usingStdout) { - echo "Wrote templatemap file to '" . realpath($output) . "'" . PHP_EOL; -} diff --git a/composer.json b/composer.json index 56e3e70133e..fcc14d7b5da 100644 --- a/composer.json +++ b/composer.json @@ -1,79 +1,85 @@ { "name": "zendframework/zendframework", - "description": "Zend Framework 2", - "type": "library", + "description": "Zend Framework", + "type": "metapackage", "keywords": [ "framework", - "zf2" + "zf2", + "zf3" ], "homepage": "http://framework.zend.com/", "license": "BSD-3-Clause", "require": { - "php": "^5.5 || ^7.0", - "zendframework/zend-authentication": "^2.5", - "zendframework/zend-barcode": "^2.5", - "zendframework/zend-cache": "^2.5", - "zendframework/zend-captcha": "^2.5", - "zendframework/zend-code": "^2.5", - "zendframework/zend-config": "^2.5", - "zendframework/zend-console": "^2.5", - "zendframework/zend-crypt": "^2.5", - "zendframework/zend-db": "^2.5", - "zendframework/zend-debug": "^2.5", - "zendframework/zend-di": "^2.5", - "zendframework/zend-dom": "^2.5", - "zendframework/zend-escaper": "^2.5", - "zendframework/zend-eventmanager": "^2.5", - "zendframework/zend-feed": "^2.5", - "zendframework/zend-file": "^2.5", - "zendframework/zend-filter": "^2.5", - "zendframework/zend-form": "^2.5", - "zendframework/zend-http": "^2.5", - "zendframework/zend-i18n": "^2.5", - "zendframework/zend-i18n-resources": "^2.5", - "zendframework/zend-inputfilter": "^2.5", - "zendframework/zend-json": "^2.5", - "zendframework/zend-loader": "^2.5", - "zendframework/zend-log": "^2.5", - "zendframework/zend-mail": "^2.5", - "zendframework/zend-math": "^2.5", - "zendframework/zend-memory": "^2.5", - "zendframework/zend-mime": "^2.5", - "zendframework/zend-modulemanager": "^2.5", - "zendframework/zend-mvc": "^2.5", - "zendframework/zend-navigation": "^2.5", - "zendframework/zend-paginator": "^2.5", - "zendframework/zend-permissions-acl": "^2.5", - "zendframework/zend-permissions-rbac": "^2.5", - "zendframework/zend-progressbar": "^2.5", - "zendframework/zend-serializer": "^2.5", - "zendframework/zend-server": "^2.5", - "zendframework/zend-servicemanager": "^2.5", - "zendframework/zend-session": "^2.5", - "zendframework/zend-soap": "^2.5", - "zendframework/zend-stdlib": "^2.5", - "zendframework/zend-tag": "^2.5", - "zendframework/zend-test": "^2.5", - "zendframework/zend-text": "^2.5", - "zendframework/zend-uri": "^2.5", - "zendframework/zend-validator": "^2.5", - "zendframework/zend-version": "^2.5", - "zendframework/zend-view": "^2.5", - "zendframework/zend-xmlrpc": "^2.5", - "zendframework/zendxml": "^1.0.1" + "php": "^5.6 || ^7.0", + "zendframework/zend-authentication": "^2.5.3", + "zendframework/zend-barcode": "^2.6", + "zendframework/zend-cache": "^2.7.1", + "zendframework/zend-captcha": "^2.6", + "zendframework/zend-code": "^3.0.2", + "zendframework/zend-config": "^2.6", + "zendframework/zend-console": "^2.6", + "zendframework/zend-crypt": "^3.0", + "zendframework/zend-db": "^2.8.1", + "zendframework/zend-debug": "^2.5.1", + "zendframework/zend-di": "^2.6.1", + "zendframework/zend-diactoros": "^1.3.5", + "zendframework/zend-dom": "^2.6", + "zendframework/zend-escaper": "^2.5.1", + "zendframework/zend-eventmanager": "^3.0.1", + "zendframework/zend-feed": "^2.7", + "zendframework/zend-file": "^2.7", + "zendframework/zend-filter": "^2.7.1", + "zendframework/zend-form": "^2.9", + "zendframework/zend-http": "^2.5.4", + "zendframework/zend-hydrator": "^2.2.1", + "zendframework/zend-i18n": "^2.7.3", + "zendframework/zend-i18n-resources": "^2.5.2", + "zendframework/zend-inputfilter": "^2.7.2", + "zendframework/zend-json": "^3.0", + "zendframework/zend-json-server": "^3.0", + "zendframework/zend-loader": "^2.5.1", + "zendframework/zend-log": "^2.9", + "zendframework/zend-mail": "^2.7.1", + "zendframework/zend-math": "^3.0", + "zendframework/zend-memory": "^2.5.2", + "zendframework/zend-mime": "^2.6", + "zendframework/zend-modulemanager": "^2.7.2", + "zendframework/zend-mvc": "^3.0.1", + "zendframework/zend-mvc-console": "^1.1.9", + "zendframework/zend-mvc-form": "^1.0", + "zendframework/zend-mvc-i18n": "^1.0", + "zendframework/zend-mvc-plugins": "^1.0.1", + "zendframework/zend-navigation": "^2.8.1", + "zendframework/zend-paginator": "^2.7", + "zendframework/zend-permissions-acl": "^2.6", + "zendframework/zend-permissions-rbac": "^2.5.1", + "zendframework/zend-progressbar": "^2.5.2", + "zendframework/zend-psr7bridge": "^0.2.2", + "zendframework/zend-serializer": "^2.8", + "zendframework/zend-server": "^2.7.0", + "zendframework/zend-servicemanager": "^3.1", + "zendframework/zend-servicemanager-di": "^1.1", + "zendframework/zend-session": "^2.7.1", + "zendframework/zend-soap": "^2.6", + "zendframework/zend-stdlib": "^3.0.1", + "zendframework/zend-stratigility": "^1.2.1", + "zendframework/zend-tag": "^2.6.1", + "zendframework/zend-test": "^3.0.1", + "zendframework/zend-text": "^2.6", + "zendframework/zend-uri": "^2.5.2", + "zendframework/zend-validator": "^2.8", + "zendframework/zend-view": "^2.8", + "zendframework/zend-xml2json": "^3.0", + "zendframework/zend-xmlrpc": "^2.6", + "zendframework/zendxml": "^1.0.2" }, "suggest": { - "zendframework/zend-ldap": "zend-ldap component ^2.5, if you need LDAP features" + "zendframework/zend-ldap": "zend-ldap component ^2.7.1, if you need LDAP features" }, - "bin": [ - "bin/classmap_generator.php", - "bin/pluginmap_generator.php", - "bin/templatemap_generator.php" - ], "extra": { "branch-alias": { "dev-master": "2.5-dev", - "dev-develop": "2.6-dev" + "dev-develop": "3.0-dev" } } }