Coder Social home page Coder Social logo

zendskeletonmodule's Introduction

Zend Framework Skeleton Module

Repository abandoned 2019-12-05

This repository is no longer maintained.

This is a sample skeleton module for use with zend-mvc applications.

Installation

First, decide on a namespace for your new module. For purposes of this README, we will use MyNewModule.

Clone this repository into your application:

$ cd module
$ git clone https://github.com/zendframework/ZendSkeletonModule MyNewModule
$ cd MyNewModule

If you wish to version the new module with your application, and not as a separate project, remove the various Git artifacts within it:

$ rm -Rf .git .gitignore

If you want to version it separately, remove the origin remote so you can specify a new one later:

$ git remote remove origin

The next step will be to change the namespace in the various files. Open each of config/module.config.php, src/Module.php, and src/Controller/SkeletonController.php, and replace any occurence of ZendSkeletonModule with your new namespace.

find and sed

You can also do this with the Unix utilties find and sed:

$ for php in $(find . -name '*.php');do
> sed --in-place -e 's/ZendSkeletonModule/MyNewModule/g' $php
> done

Next, we need to setup autoloading in your application. Open the composer.json file in your application root, and add an entry under the autoload.psr-4 key:

"autoload": {
    "psr-4": {
        "MyNewModule\\": "module/MyNewModule/src/"
    }
}

When done adding the entry:

$ composer dump-autoload

Finally, notify your application of the module. Open config/modules.config.php, and add it to the bottom of the list:

return [
    /* ... */
    'MyNewModule',
]

application.config.php

If you are using an older version of the skeleton application, you may not have a modules.config.php file. If that is the case, open config/application.config.php instead, and add your module under the modules key:

'modules' => [
    /* ... */
    'MyNewModule',
],

zendskeletonmodule's People

Contributors

akrabat avatar binarykitten avatar cgmartin avatar evandotpro avatar freeaqingme avatar jamescarr avatar lansoweb avatar maks3w avatar ocramius avatar ralphschindler avatar samsonasik avatar sasezaki avatar socalnick avatar timdev avatar twogood avatar weierophinney avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

zendskeletonmodule's Issues

More examples ?

Hi there,
I would be great that this module show an example to:

  • create a simple form
  • create a simple I18n/Translation
  • etc...

David

Fix tests by adding support for SharedEventManager

It seems that the SharedEventManager change in ZF2 broke tests.

If I do the following:

$ git clone git://github.com/zendframework/ZendSkeletonApplication.git
$ cd ZendSkeletonApplication/
$ ./composer.phar self-update
$ ./composer.phar install
$ cd module/
$ git clone git://github.com/zendframework/ZendSkeletonModule.git 
$ cd ZendSkeletonModule/tests/
$ vi TestConfiguration.php.dist        # to fix path for composer-managed zf
$ phpunit 

PHPUnit dies like so:

bash-3.2$ phpunit

Fatal error: Call to a member function attach() on a non-object in /Users/tim/test23/ZendSkeletonApplication/vendor/zendframework/zendframework/library/Zend/ModuleManager/Listener/OnBootstrapListener.php on line 42

Call Stack:
    0.0002     635984   1. {main}() /web/php/bin/phpunit:0
    0.0348    1209888   2. PHPUnit_TextUI_Command::main() /web/php/bin/phpunit:46
    0.0348    1210616   3. PHPUnit_TextUI_Command->run() /web/php/lib/php/PHPUnit/TextUI/Command.php:130
    0.0348    1210616   4. PHPUnit_TextUI_Command->handleArguments() /web/php/lib/php/PHPUnit/TextUI/Command.php:139
    0.0394    1862952   5. PHPUnit_TextUI_Command->handleBootstrap() /web/php/lib/php/PHPUnit/TextUI/Command.php:620
    0.0396    1879448   6. PHPUnit_Util_Fileloader::checkAndLoad() /web/php/lib/php/PHPUnit/TextUI/Command.php:867
    0.0396    1879600   7. PHPUnit_Util_Fileloader::load() /web/php/lib/php/PHPUnit/Util/Fileloader.php:79
    0.0398    1915720   8. include_once('/Users/tim/test23/ZendSkeletonApplication/module/ZendSkeletonModule/tests/bootstrap.php') /web/php/lib/php/PHPUnit/Util/Fileloader.php:95
    0.0502    3262336   9. Zend\ModuleManager\ModuleManager->loadModules() /Users/tim/test23/ZendSkeletonApplication/module/ZendSkeletonModule/tests/bootstrap.php:69
    0.0503    3263624  10. Zend\EventManager\EventManager->trigger() /Users/tim/test23/ZendSkeletonApplication/vendor/zendframework/zendframework/library/Zend/ModuleManager/ModuleManager.php:100
    0.0503    3263752  11. Zend\EventManager\EventManager->triggerListeners() /Users/tim/test23/ZendSkeletonApplication/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php:209
    0.0513    3352536  12. call_user_func() /Users/tim/test23/ZendSkeletonApplication/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php:469
    0.0513    3352568  13. Zend\ModuleManager\ModuleManager->onLoadModules() /Users/tim/test23/ZendSkeletonApplication/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php:469
    0.0513    3352872  14. Zend\ModuleManager\ModuleManager->loadModule() /Users/tim/test23/ZendSkeletonApplication/vendor/zendframework/zendframework/library/Zend/ModuleManager/ModuleManager.php:81
    0.0519    3369560  15. Zend\EventManager\EventManager->trigger() /Users/tim/test23/ZendSkeletonApplication/vendor/zendframework/zendframework/library/Zend/ModuleManager/ModuleManager.php:146
    0.0519    3369600  16. Zend\EventManager\EventManager->triggerListeners() /Users/tim/test23/ZendSkeletonApplication/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php:209
    0.0526    3446032  17. call_user_func() /Users/tim/test23/ZendSkeletonApplication/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php:469
    0.0526    3446064  18. Zend\ModuleManager\Listener\OnBootstrapListener->__invoke() /Users/tim/test23/ZendSkeletonApplication/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php:469

I managed to track this down to a missing SharedEventManager

Pull request will be up shortly.

Test Bootstrap don't work

Bootstrap don't work.
Linked to this issue
#19

if i run it

./vendor/bin/phpunit  --bootstrap=./module/Users/tests/bootstrap.php module/Users/tests/
PHP Fatal error:  Class 'UsersTest\Framework\TestCase' not found in /home/seyfer/www/zend2-tutorial.me/module/Users/tests/Users/SampleTest.php on line 18

Now i need include file by myself in SampleTest.php
require_once 'Framework/TestCase.php';

Ok, now it runs, but assert fails

1) UsersTest\SampleTest::testSample
Failed asserting that null is an instance of interface "Zend\Di\LocatorInterface".

/home/seyfer/www/zend2-tutorial.me/module/Users/tests/Users/SampleTest.php:22

FAILURES!                            
Tests: 1, Assertions: 1, Failures: 1.

If i run it from module tests/ folder - same errors.

So, bootstrap by default don't work like it need to work.
And after installing this ZendSkeletonModule users need to change Bootstrap for testing to something like:
https://github.com/phly/PhlySimplePage/blob/master/test/Bootstrap.php
or
https://github.com/EvanDotPro/SpeckCart/blob/master/tests/Bootstrap.php

Why not include working Bootstrap.php by default?

Like framework user, i want working solution after install SkeletonModule and just add my Test classes and run it with configuration by default.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.