Giter VIP home page Giter VIP logo

magento2-samples's Introduction

Synopsis

This project is a collection of samples to demonstrate technologies introduced in Magento 2. You will find the most simple extension along with samples that incrementally add features to lead you through a exploration and education of the Magento 2 platform.

Motivation

The intent is to learn by example, following our best practices for developing a modular site using Magento 2.

Installation

Each sample is packaged and available individually at repo.magento.com. For convenience and demonstration of our bundling of modules, we have included the sample-bundle-all composer metapackage. Including this dependency in your Magento project is the more convenient way to integrate the full set of examples. Refer to that sample for more detailed installation instructions.

To install any of these samples, you'll need to be sure that your root composer.json file contains a reference to the repository that contains them. To do so, add the following to composer.json:

    "repositories": [
        {
            "type": "composer",
            "url": "http://repo.magento.com/"
        }
    ]

The above can also be added using the Composer command line with the command:

composer config repositories.magento composer http://repo.magento.com/

Registration

New in Magento 2 is the ability to register modules to install anywhere under the Magento root directory; typically, under the vendor subdirectory.

All sample modules have a registration.php in their root directory with contents similar to the following:

<?php
/**
 * Copyright © 2015 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */

\Magento\Framework\Component\ComponentRegistrar::register(
    \Magento\Framework\Component\ComponentRegistrar::MODULE,
    'Magento_CommandExample',
    __DIR__
);

The preceding example registers the Magento_CommandExample component to install under Magento's vendor directory. For more information about component registration, see the PHP Developer's Guide.

In addition, each module's composer.json references registration.php in its autoload section as follows:

{
  "name": "magento/sample-module-command",
  "description": "Command example",
  "type":"magento2-module",
  "require": {
    "php": "~5.5.0|~5.6.0|~7.0.0"
  },
  "version": "1.0.0",
  "autoload": {
    "files": [ "registration.php" ],
    "psr-4": {
      "Magento\\CommandExample\\": ""
    }
  }
}

PSR-4 section

Each module's composer.json has a psr-4 section except for sample-module-theme. Themes don't require it because they do not reference

Contributors

Magento Core team

License

Open Source License

magento2-samples's People

Contributors

texanhogman avatar igrybkov avatar eddielau avatar otoolec avatar dell- avatar dkvashninbay avatar miakusha avatar navarr avatar vinai avatar vpelipenko avatar marcozheng avatar sivajik34 avatar

Watchers

James Cloos avatar Sheikh Shah Mohammad Motiur Rahman avatar

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.