I implemented an autoloader. Locally, everything works fine, but once i upload it to the production server, all classes are not found.
{
"require": {
"facebook/php-sdk": "#stable",
"everyman/neo4jphp": "dev-master",
"predis/predis": "1.0.1",
"aws/aws-sdk-php": "2.*"
},
"autoload": {
"psr-0": {
"PicoCore\\": "",
"PicoCore\\Authentication\\" : "PicoCore/authentication",
"PicoCore\\Aws\\" : "PicoCore/aws",
"PicoCore\\Cache\\" : "PicoCore/cache",
"PicoCore\\Database\\" : "PicoCore/database",
"PicoCore\\Database\\Managers\\" : "PicoCore/database/managers",
"PicoCore\\Facebook\\" : "PicoCore/facebook",
"PicoCore\\Objects\\" : "PicoCore/objects",
"PicoCore\\Rest\\" : "PicoCore/rest",
"PicoCore\\Configuration\\" : "PicoCore/configuration",
"PicoCore\\Configuration\\Api\\" : "PicoCore/configuration/api",
"PicoCore\\Configuration\\PictureReceiver\\" : "PicoCore/configurat$
"PicoCore\\Configuration\\PictureUploader\\" : "PicoCore/configurat$
"PicoCore\\Scripts\\" : "PicoCore/scripts",
"PicoCore\\Times" : "PicoCore/times"
}
}
}
I read here composer autoload not working on production server that maybe it because of the \. Is it correct ? And if so, where do i put this funciton?
Related
Restarted computer today, after that, my composer injects Unicode symbols in my HTML file (index.php).
$��m��mo�L�D��;�%g�?w��ŷ���ovH0��a�5��*�ؒ��l͛�S�iy�r�O7����%L]��%���hk����>v1�HB������d\�(eoIx�>3�6BS%���( ��f$�h�����eԎ���H���`ݶf{�Fo�Y���#00uMb�z-��XI$&�gf���7Ӵ�u|'K.�oP P���F�.��o��9B<~.����[����<٭�$�����{1�A��.�bKx�L������'�u8n5
Testcases init // <-- this is from me
{
"config": {
"platform": {
"php": "8.1.5"
}
},
"autoload": {
"files": [
"server/Settings/DatabaseSettings.php",
"server/Settings/FormatSettings.php",
"server/Settings/LanguageSettings.php",
"server/Settings/MetaSettings.php",
"server/Settings/PathSettings.php"
],
"psr-4": {
"Controller\\": "server/Controller/",
"Language\\": "server/Language"
}
},
"require": {
}
}
Have already re-installed Composer via console and deleted vendor directory and composer.lock.
Instead of using
"require": {
"vendor/custom package" : "master#dev"
}
I want to use
"require": {
"vendor/custom package" : "^1.0.0"
}
I couldn't find a way to add version number to the package. when I enter "*" instead of "dev#master", composer can't find the package in gitlab.
"repositories": [
{
"type": "vcs",
"url": "https://gitlab.com/your-org/custom_package"
}
],
"require": {
"vendor/custom_package": "1.0.*"
}
I developed a Laravel 5.5 package with package auto discovery and pushed it at git hub
https://github.com/adamibrahim/authconfirm
when i run
$ composer require "adamibrahim/authconfirm" : "v0.1.1"
I got an error
could not find package adamibrahim/authconfirm at any version for your min ...
do i need to register my repository somewhere so i can use composer require command ?
here is my package composer.json
{
"name": "adamibrahim/authconfirm",
"type": "library",
"description": ":Laravel 5.5 Auth modifications to confirm the auth email",
"keywords": [
"Laravel5.5",
"Auth",
],
"homepage": "https://github.com/adamibrahim/authconfirm",
"license": "MIT",
"authors": [
{
"name": ":Adam Ibrahim",
"email": ":adamibrahim1701#gmail.com",
"homepage": ":author_website",
"role": "Developer"
}
],
"require": {
"illuminate/support": "~5.1",
"php" : "~5.6|~7.0"
},
"require-dev": {
"phpunit/phpunit" : ">=5.4.3",
"squizlabs/php_codesniffer": "^2.3"
},
"autoload": {
"psr-4": {
"Adamibrahim\\Authconfirm\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"Adamibrahim\\Authconfirm\\": "tests"
}
},
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
}
},
"config": {
"sort-packages": true
}
}
Well, it's not enough just to create Github repository to use it via composer. You should create account at https://packagist.org/ and add your package in there to make it available via composer require.
In addition you should setup Packagist integration on Github at:
https://github.com/adamibrahim/authconfirm/settings/installations
to make sure after changes in Github Packagist will see those changes.
I am using TYPO3 in composer mode and right now, I am stuck with an unsupported version of TYPO3 (Version 8.4) because my only dependency EXT:RealURL requires TYPO3 < 8.5, thus preventing me from upgrading.
{
"repositories": [
{ "type": "composer", "url": "https://composer.typo3.org/" }
],
"name": "typo3/cms-base-distribution",
"description" : "TYPO3 CMS Base Distribution",
"license": "GPL-2.0+",
"require": {
"typo3/cms": "^8.4",
"typo3-ter/realurl": "^2.1"
},
"extra": {
"typo3/cms": {
"cms-package-dir": "{$vendor-dir}/typo3/cms",
"web-dir": "web"
}
}
}
RealURL composer.json
"require": {
"typo3/cms-core": ">=6.2.0,<8.5.0",
"php": ">=5.4.0"
},
I am not sure what my options are right now:
Deal with an unsupported version auf TYPO3 or abandon RealURL, breaking existing URLs, or ?
It would be great if you could point out, if I am missing a viable option here :)
Until realurl is updated you may use:
"require": {
"typo3/cms": "8.5.1 as 8.4.99",
"typo3-ter/realurl": "^2.1"
}
Tried to install composer in windows through command line. Downloaded composer.phar. Placed it in C/wamp/www/s/ folder. During installation got this error.
[RuntimeException]
Error Output: make: *** No rule to make target `compile-json'. Stop.
What should I do now..?
This is my composer.json
{
"name": "aws/aws-sdk-php",
"homepage": "http://aws.amazon.com/sdkforphp",
"description": "AWS SDK for PHP - Use Amazon Web Services in your PHP project",
"keywords": ["aws","amazon","sdk","s3","ec2","dynamodb","cloud","glacier"],
"type": "library",
"license": "Apache-2.0",
"authors": [
{
"name": "Amazon Web Services",
"homepage": "http://aws.amazon.com"
}
],
"support": {
"forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80",
"issues": "https://github.com/aws/aws-sdk-php/issues"
},
"require": {
"php": ">=5.5",
"guzzlehttp/guzzle": ">=5.3|~6.0.1|~6.1",
"guzzlehttp/guzzle":"~4.0",
"guzzlehttp/psr7": "~1.0",
"guzzlehttp/promises": "~1.0",
"mtdowling/jmespath.php": "~2.2"
},
"require-dev": {
"ext-openssl": "*",
"ext-pcre": "*",
"ext-spl": "*",
"ext-json": "*",
"ext-dom": "*",
"ext-simplexml": "*",
"phpunit/phpunit": "~4.0",
"behat/behat": "~3.0",
"doctrine/cache": "~1.4",
"aws/aws-php-sns-message-validator": "~1.0"
},
"suggest": {
"ext-openssl": "Allows working with CloudFront private distributions and verifying received SNS messages",
"ext-curl": "To send requests using cURL",
"doctrine/cache": "To use the DoctrineCacheAdapter"
},
"autoload": {
"psr-4": {
"Aws\\": "src/"
},
"files": ["src/functions.php"]
},
"autoload-dev": {
"psr-4": {
"Aws\\Test\\": "tests/"
}
},
"extra": {
"branch-alias": {
"dev-master": "3.0-dev"
}
},
"scripts": {
"post-autoload-dump": [
"make compile-json"
]
}
}
Thank you for posting your composer.json file.
The error comes from the following invalid entry:
"scripts": {
"post-autoload-dump": [
"make compile-json"
]
}
The make command will not work on Windows.
I suggest to simply remove this part of the file and try again.
(Its not clear to me, which of your project dependencies needs an additional make step and why you added it. Anyway this composer.json seems to be identical to https://github.com/aws/aws-sdk-php/blob/master/composer.json . If you want to contribute to this project ask them how to build on Windows :)
If you simply want to fetch the aws-sdk-php package.
Follow their installation guide: http://docs.aws.amazon.com/aws-sdk-php/v3/guide/getting-started/installation.html
Use php composer.phar require aws/aws-sdk-php on the CLI.
Or add aws/aws-sdk-php to your require section and then run composer install, like so:
{
"require": {
"aws/aws-sdk-php": "^3.3"
}
}