I want install this.
I installed composer, set the environment variable path in w10.
Edit the composer.json located in this folder:
C:\Bitnami\wampstack-5.5.29-1\php\PEAR
with this content:
{
"name":"amazonwebservices/aws-sdk-for-php",
"description":"AWS SDK for PHP",
"keywords":["aws","amazon","sdk","s3","ec2","dynamodb"],
"type":"library",
"license":"Apache-2.0",
"authors":[
{
"name":"Amazon Web Services",
"homepage":"http://aws.amazon.com"
}
],
"homepage": "http://aws.amazon.com/sdkforphp/",
"require":{
"php":">=5.2.0"
},
"autoload":{
"classmap": [
"authentication/",
"extensions/",
"lib/",
"services/",
"utilities/",
"sdk.class.php"
]
}
}
{
"require": {
"katzgrau/klogger": "dev-master"
}
}
but when I execute this command in my console:
composer require katzgrau/klogger:dev-master
I get:
nothing to install or update
what I did wrong?
You are reusing the composer.json file of "aws-sdk-for-php".
That is probably not your project. And you are in the wrong folder (PEAR).
Don't copy and paste composer.json files... anyway:
Create a new project folder
then simply run composer require katzgrau/klogger:1.2.0
You'll get all dependencies fetched into the vendor folder and a fresh composer.json file for your project.
Related
I'm trying to create a project with composer-file.
Reason is primarily a dependency which I never want to upload to git.
My intended structure is this:
project-root-folder
- project-sub-folder(s)
- vendor (with required dependencies)
- index.php
- composer.json
- README.md
But the installed structure using composer is this:
project-root-folder
- vendor
- vendor/composer
- vendor/smarty (dependency)
- vendor/my-project
- composer.json
I know that there are special installers for many different projects, I just don't understand that an installer is required to get the intended structure and also not how to do it without a special installer.
This is the content of one composer file I tried:
{
"name": "wdb/tutorial-oop",
"require": {
"smarty/smarty": "~3.1"
}
}
When I tried this composer-json content in a local file and just extecute composer install I get the same structure:
{
"require": {
"wdb/tutorial-oop": "dev-master"
}
}
So my question is, how a composer file has to look that the project structure is created like I described in the top of this question. The basic problem is that I don't want my project being installed as dependency in the vendor-directory but in the root of the project folder, and additionally that I don't want to use the composer autoloader.
Edit:
On request here my full composer file inside the project root:
{
"name": "wdb/tutorial-oop",
"type": "project",
"description": "Your package description goes here",
"keywords": ["oop","mvc","tutorial"],
"homepage": "https://barlians.com",
"license": "GPL-3.0-or-later",
"authors": [
{
"name": "David Bruchmann",
"email": "david.bruchmann#gmail.com",
"homepage": "https://barlians.com",
"role": "Author, Developer"
}
],
"support": {
"email": "david.bruchmann#gmail.com"
},
"require": {
"smarty/smarty": "~3.1"
}
}
You're installing your project in incorrect way. The composer require command is for installing dependencies, so they're installed to the vendor directory.
For installing a project you should use the create-project command:
composer create-project wdb/tutorial-oop
I have two projects I am working on, both were setup as git repos, both use composer.
First project uses second as a library.
I configured composer.json in the following way:
... "repositories": [
{"type": "composer", "url":"http://composer.myrepourl.com/repo/private/"},
]
"require": {
"second/second": "dev-B-3"
} ...
There was no problem pulling the project from a repository for the first time. However now I made some changes in second project, pushed to the repo and now want to have them in first project, but for some reason composer pulls from the cache.
I ran composer clear-cache. I tried deleting: vendor folder, /home/user/.composer/cache, cache inside container /root/.composer/, but it still finds a way to clone the second project from cache instead of pulling it from repo.
Any ideas on how to force composer to always pull from repo instead of cloning from cache?
Run
$ composer install --prefer-source
Alternatively, specify your preferred installation method in composer.json generally:
{
"config": {
"preferred-install": "source"
}
}
or specifically for the desired dependency
generally:
{
"config": {
"preferred-install": {
"vendor/package": "source",
"*": "dist"
}
}
}
For reference, see:
https://getcomposer.org/doc/03-cli.md#install
https://getcomposer.org/doc/06-config.md#preferred-install
you should run
composer clear-cache
then
composer update --prefer-source
Ok I have found a solution:
sudo rm -r /home/user/project/vendor
cd %wherever_your_docker_is%
docker-compose stop
docker-compose rm
docker-compose up -d
composer update
I just wrote my first TYPO3 Extension, but it doesn't work :(
I got this error message at my TYPO3 Frontend:
Could not analyse class:
"Snowboard\SnowboardStaff\Controller\SnowboardTeacherController" maybe
not loaded or no autoloader? Class
Snowboard\SnowboardStaff\Controller\SnowboardTeacherController does
not exist
I installed TYPO3 with composer. So may be this problem have something to do with this?
I already tried al lot, so please help me :)
If you installed your extension with composer you can place the autoload in the extension's composer.json file like "Thomas" already wrote. But if you just put your extension into the typo3cond/ext folder you must add the autoload settings in the main composer.json file in your root directory.
composer.json in the extension:
"autoload": {
"psr-4": {
"Vendor\\Yourext\\": "Classes/"
}
},
composer.json in root:
"autoload": {
"psr-4": {
"Vendor\\Yourext\\": "web/typo3conf/ext/startpilot/Classes"
}
},
You have to add the location of your classes into your extension's composer.json:
"autoload": {
"psr-4": {
"Snowboard\\SnowboardStaff\\": "Classes/",
}
}
I am trying to create a new project with composer laravel, but I get this error, as could fix it ??
Note: I installed the .exe installer composer
Looks like you need to add a parameter your global composer.json file. On UNIX it's located in ~/.composer/composer.json .
Open up that file and add this:
"secure-http": false
My whole composer.json file looks like this:
{
"require": {
"laravel/installer": "^1.3"
},
"secure-http": false
}
Since you're using Windows, you'll need to find where this file is.
Let's say my package in Laravel is test/test.
I created the package in the workbench and it's been working great following Jason Lewis' tutorial. Now I want to move the package out of
the workbench to the vendor directory. This is where all tutorials fall short, even the laravel docs. I didn't want to use git to move the files, so I simply copied the test/test package from the workbench to the vendor directory (and then deleted it from the workbench). I didn't copy the test/test/vendor folder from the workbench (or any other files I noticed in the .gitignore file). I then ran composer install from my new vendor/test/test directory. I then did a composer dump-autoload from the laravel root directory.
Now when I run my application I get an error that I did not get when the package was in the workbench:
Class 'Test\Test\TestServiceProvider' not found
(this is coming from \bootstrap\compiled.php on line 4121)
I also did a php artisan dump-autoload from the laravel root and I get this same error.
Any ideas? Or can someone lead me to a tutorial that takes the package development all the way to it's final resting point in the vendor directory?
Got it working.
I added:
"psr-0": {
"Test\\Test": "vendor/test/test/src/"
}
to the autoload section in composer.json in the laravel root directory so it looks like this:
"autoload": {
"classmap": [
"app/commands",
"app/controllers",
"app/models",
"app/database/migrations",
"app/database/seeds",
"app/tests/TestCase.php"
],
"psr-0": {
"Test\\Test": "vendor/test/test/src/"
}
},
If I decide to put the package on Packagist later then I might remove this from the autoload and just keep the package referenced in the "require" part of my composer.json. We'll see what happens when I get that far!
I think you can install your packages from your hard drive as from local repository like this:
"repositories": [
{
"type":"vcs",
"url":"/path/to/repo/here"
}
],
"require":{
"me/myrepo":"dev-master"
}