Download the PHP package m2demo/module-m2-extension without Composer

On this page you can find all versions of the php package m2demo/module-m2-extension. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package module-m2-extension

Reference Module

Thank you for trying the Magento reference module! We created it to get you started with module development as quickly as possible. Right now it simply displays a list of Magento modules but you can use it to:

Installing and verifying the reference module

You can install the reference module in any of the following ways:

  1. By copying the code to your <your Magento install dir>/app/code/<VendorName>/<ModuleName> directory.
    This method requires some manual tasks but it easy.
  2. Using composer update.

Installing the module by copying code

Any Magento module requires a particular directory structure under <your Magento install dir>/app/code. The structure starts with:

<VendorName>/<ModuleName>

The reference module requires the following structure:

M2demo/M2Extension

To add the module to your Magento installation:

  1. Log in to your Magento server as a user with privileges to write to the web server docroot (typically either the root user or the web server user).
  2. Enter the following commands in the order shown:

    cd <your Magento install dir>/app/code
    mkdir -p M2demo/M2Extension
  3. Go to the reference module GitHub.
  4. Click Download Zip.
  5. Copy the .zip file you downloaded to your Magento server's <magento install dir>/app/code/m2demo/module-m2-extension directory.
  6. Enter the following commands in the order shown:

    unzip m2extension-master.zip
    mv m2extension-master/* .
    rm -rf m2extension-master
  7. Open <your Magento install dir>/app/etc/config.php in a text editor.
  8. Add the following anywhere under: 'modules' => array (:

    'M2Demo_M2Extension' => 1
  9. Save your changes and exit the text editor.

Installing the module using Composer

To install any module using composer update, you must modify the Magento 2 composer.json. The changes required for the reference module are simple, and after that it installs automatically.

To use Composer to install the module:

  1. Log in to your Magento server as a user with root privileges.

    Note: On Ubuntu, you might need to use the sudo su command.

  2. Change to your Magento installation directory.
  3. Open composer.json in a text editor.
  4. Add the following line in the "require": section:

    "m2demo/module-m2-extension": "*"

    Note: Make sure the preceding line ends with a comma character.

  5. In the autoload": { "psr-4" section, add the following line:

    "M2Demo\\": "app/code/M2Demo/"

    Note: Make sure the preceding line ends with a comma character.

  6. Save your changes and exit the text editor.
  7. From your Magento installation directory, enter the following commands in the order shown:

    composer dump-autoload
    composer update

Verifying the reference module

  1. Log in to your Magento server as a user with root privileges.
  2. Enter the following commands in the order shown to clear the Magento cache:

    cd <your Magento install dir>/var
    rm -rf cache page_cache
  3. If you're currently logged in to the Magento Admin, log out.
  4. Log in to the Magento Admin as an administrator.
  5. Click Stores > Configuration > ADVANCED > Advanced > Disable Modules Output.

If m2demo_module-m2-extension displays in alphabetical order, you successfully installed the reference module!

To see the reference module at work, enter the following URL in your browser's address or location field:

    http[s]://<your web server IP or host name>/<your Magento base dir>/demo_extension/index/sayhello

For example:

    http://www.example.com/magento/demo_extension/index/sayhello

A list of Magento modules displays. That's it! You're done!

Components

composer.json

Root

To autoload classes in the module more quickly, the root composer.json must be updated. Place the following line in the autoload->psr-4 section:

For reference, see Composer's autoloading documentation.

Module

To integrate the module with composer, a composer.json file must be placed in the root of the extension.

Routing

A router takes the given request and determines which controller and action should handle it. Routing options are configured in "etc/routes.xml" (relative to extension root).

Router

The router element's id attribute determines which router to use for this module.

Route

The route element's id attribute provides a unique name for the router and module pair. Used for merging config information of multiple routers.

Frontname

The module element's frontname attribute is what will show up in the url corresponding to the module.

Area

During runtime, one of several areas is always active, depending on the type of user and code being executed. This module is meant for the frontend area. The directory structure is: Extension/etc/area/routes.xml

module.xml

The module.xml file defines the name of the module. If any of the module's dependencies need to be loaded in a particular sequence, this file can also store that sequence.

Controller

The controller class is in app/code/M2Demo/M2Extension/Controller/Index/SayHello.php.

URL

The controller is accessed at the URL /demo_extension/index/sayhello

Code

The controller class extends \Magento\Framework\App\Action\Action. It implements an execute() method, which contains the controller's business logic. In this case, it prints out a short message and a list of active modules. If it renders output, the output must go into the _response object.

Response

The _response object stores the information that is sent back to the client. It is a protected member of the class defined by a parent.

Parent

The parent's dispatch() method calls execute(), and then returns the _response back to the system, which delivers it to the client.


All versions of module-m2-extension with dependencies

PHP Build Version
Package Version
Requires php Version ~5.4.11|~5.5.0
magento/magento-composer-installer Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package m2demo/module-m2-extension contains the following files

Loading the files please wait ....