composer require nette/nette … is not enough

Nicolas_K
Member | 25
+
0
-

__FYI__
composer require nette/nette
as suggested here: https://nette.org/en/packages
results in composer.json as

{
    "require": {
        "nette/nette": "^3.2"
    }
}

BUT – that is not enough, it doesn't work (leaves a blank screen without Tracy).
It has to be added:

	"autoload": {
		"psr-4": {
			"App\\": "app"
		}
	}

(and – of course – composer update).
Put together:

{
	"name": "nette/minimal",
	"description": "Nette: Minimal",
	"keywords": ["nette"],
	"type": "project",
	"license": ["MIT", "BSD-3-Clause", "GPL-2.0", "GPL-3.0"],
   	"minimum-stability": "stable",
    "require": {
        "nette/nette": "^3.2"
    },
	"autoload": {
		"psr-4": {
			"App\\": "app"
		}
	}
}

The first 6 keys (name, descr., keywords, type, license, minimus-stab.)
are not neccessary to get a result, but autoload is.
(Same with nette/nette 3.1)
This enabled me finally to get my very minimalistic website work :))

materix
Member | 66
+
0
-

Thanks, it think that is how Composer works.

You could also do composer create-project nette/web-project path/to/install as described here: https://github.com/…/web-project. That is what I usually do.

Nicolas_K
Member | 25
+
0
-

Yes with composer create-project nette/... it copies the composer.json provided there.
The major hint in this respect is here:
https://doc.nette.org/…ces/composer#…
…which has to be kept in mind when ‘composing’ a project by hand.
Thank you!