GithubHelp home page GithubHelp logo

amenk / composer-plugin Goto Github PK

View Code? Open in Web Editor NEW

This project forked from contao-community-alliance/composer-plugin

0.0 2.0 0.0 443 KB

Composer plugin that provide contao integration and installer.

PHP 100.00%

composer-plugin's Introduction

Contao Composer Plugin

Version ![Stable Build Status](http://img.shields.io/travis/contao-community-alliance/composer-plugin/master.svg?style=flat-square&label=stable build) ![Upstream Build Status](http://img.shields.io/travis/contao-community-alliance/composer-plugin/develop.svg?style=flat-square&label=dev build) License Downloads

contao composer installer

Sources

Contao require a strict module structure. Composer install all dependencies into the vendor directory, using the complete repository structure. Both often not match each other.

To solve this problem, without making a lot of shadow copies the contao-module installer create symlinks.

Hint for users: Symlinks require a good server setup. To work with Apache2 the FollowSymLinks option is mostly required.

Hint for developers: PHP will follow symlinks by default, but using __DIR__ or __FILE__ will return the real path. You will get composer/vendor/me/my-module/MyClass.php instead of system/modules/my-module/MyClass.php.

Hint for Windows users: Symlinks on Windows require PHP 5.3+, but this is no real problem, because composer require PHP 5.3+ ;-)

Installing repository root as module my-module: Hint: This is the implicit fallback (system/modules/$packageName), if no symlinks specified!

{
	"extra": {
		"contao": {
			"sources": {
				"": "system/modules/my-module"
			}
		}
	}
}

Installing repository sub-path src/system/modules/my-module as module my-module:

{
	"extra": {
		"contao": {
			"sources": {
				"src/system/modules/my-module": "system/modules/my-module"
			}
		}
	}
}

Userfiles

Sometimes you need to provide user files (files within the (tl_)files directory). There is a support to install these user files. Normally these files can be modified by users. To protect user changes, user files are only copied if they are not exists. The installer will never overwrite a user file.

Hint: User files are installed into the $uploadPath directory, not TL_ROOT.

{
	"extra": {
		"contao": {
			"userfiles": {
				"src/system/modules/my-module/files/images": "my-module/images"
			}
		}
	}
}

Runonces

Putting your runonce.php into your modules config directory is not a good idea in combination with composer. After contao runs the runonce.php it get deleted. Next time you do an update, composer complains about this modification. To solve this, you can define your runcone.php's, yes you are right, you can use multiple runonce.php files. There is no need to name them runonce.php, feel free to use any other name.

{
	"extra": {
		"contao": {
			"runonce": [
				"src/system/modules/my-module/runonce/init_update.php",
				"src/system/modules/my-module/runonce/do_db_update.php",
				"src/system/modules/my-module/runonce/refresh_entities.php"
			]
		}
	}
}

Hint: The order of the runonce files is taken into account.

Hint: No, the installer will not support directories. This is just to protect unexpected behavior.

composer-plugin's People

Contributors

backbone87 avatar discordier avatar dmolineus avatar tristanlins avatar zeromax avatar

Watchers

 avatar  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.