Laravel 5.5 - Load migrations from nested packages - laravel

I'm working currently on some Laravel packages and have a question about integrating nested packages.
I've packages for Tagging & Roles and would like to integrate them into another Blogging Packages.
But I'm not able to load the migrations from the nested (Tagging & Roles) packages.
I'm currently trying to load the Service Provider of the packages within the BlogServiceProvider (register function). But alway get an error when I try to do an composer update or dump-autoload
$this->app->register(
'OName\Taggy\TaggyServiceProvider'
);
$this->app->register(
'OName\Roles\RolesServiceProvider'
);
Composer.json from the Blog Package
"require": {
"php": ">=7.0.0",
"illuminate/database": ">= 5.0",
"illuminate/support": ">= 5.0",
"OName/taggy": "^1.0"
},
"require-dev": {
"orchestra/testbench": "~3.5",
"phpunit/phpunit": "~6.0"
},
"autoload-dev": {
"classmap": [
"tests/TestCase.php"
]
},
"extra": {
"laravel": {
"providers": [
"OName\\Blog\\App\\Providers\\BlogServiceProviders"
]
}
}
Composer.json from the Taggy Package
"autoload": {
"psr-4": {
"OName\\Taggy\\": "src"
}
},
"require": {
"php": ">=7.0.0",
"illuminate/database": ">= 5.0",
"illuminate/support": ">= 5.0"
},
"require-dev": {
"orchestra/testbench": "~3.5",
"phpunit/phpunit": "~6.0"
},
"autoload-dev": {
"classmap": [
"tests/TestCase.php",
"tests/stubs/TopicStub.php",
"tests/stubs/TagStub.php"
]
},
"extra": {
"laravel": {
"providers": [
"OName\\Taggy\\App\\Providers\\TaggyServiceProvider"
]
}
}
Error:
[Symfony\Component\Debug\Exception\FatalThrowableError]
Class 'OName\Taggy\TaggyServiceProvider' not found

Related

Package Level Composer Not Triggered in Lumen Package Development

I'm trying to create a package to publish in packagist, for this I am using the package level composer.json to install the dependencies.
my package level composer.json is as follow
{
"name": "my-company/my-package",
"description": "Package Desciption",
"authors": [
{
"name": "xxxxx",
"email": "xxxxx#gmail.com"
}
],
"minimum-stability": "dev",
"require": {
"propaganistas/laravel-phone": "^4.1"
}
}
I declare this on my main root autoload in composer.json as follow:
"autoload": {
"classmap": [
"database/seeds",
"database/factories"
],
"psr-4": {
"App\\": "app/",
"MyCompany\\MyPackage\\": "packages/my-company/my-package/"
}
},
when I run the composer install in the root composer.json the child composer.json is not triggered.
finally, I solve this by adding repository block and define the path in the root composer.json and also adding the newly create package name into the require-dev
"repositories": [
{
"type": "path",
"url": "packages/my-company/my-package"
}
],
"require-dev": {
"fzaninotto/faker": "~1.4",
"phpunit/phpunit": "~7.0",
"mockery/mockery": "~1.0",
"my-company/my-package": "1.0.*"
},

laravel package development - develop multiple packages that depend on eachother

I am trying to setup up a development environment for my previously developed packages which depend on eachother. I could setup laravel and a packages directory in which I cloned all the packages into. But now when I add them to laravel composer.json file and run composer update I run in the following error.
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for tjventurini/sunshine dev-master -> satisfiable by tjventurini/sunshine[dev-master].
- tjventurini/sunshine dev-master requires tjventurini/articles ^0.1.8 -> satisfiable by tjventurini/articles[v0.1.8] but these conflict with your requirements or minimum-stability.
Problem 2
- tjventurini/articles dev-master requires tjventurini/tags ^0.0.9 -> satisfiable by tjventurini/tags[v0.0.9] but these conflict with your requirements or minimum-stability.
- tjventurini/articles dev-master requires tjventurini/tags ^0.0.9 -> satisfiable by tjventurini/tags[v0.0.9] but these conflict with your requirements or minimum-stability.
- Installation request for tjventurini/articles dev-master -> satisfiable by tjventurini/articles[dev-master].
This is how my laravel composer.json file looks like:
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": [
"framework",
"laravel"
],
"license": "MIT",
"type": "project",
"minimum-stability": "dev",
"prefer-stable" : true,
"repositories": [
{
"type": "path",
"url": "packages/sunshine"
},
{
"type": "path",
"url": "packages/articles"
},
{
"type": "path",
"url": "packages/portfolio"
},
{
"type": "path",
"url": "packages/tags"
},
{
"type": "path",
"url": "packages/mini-bootstrap-theme"
},
{
"type": "path",
"url": "packages/contact"
}
],
"require": {
"php": ">=7.0.0",
"fideloper/proxy": "~3.3",
"laravel/framework": "5.5.*",
"laravel/tinker": "~1.0",
"tjventurini/mini-bootstrap-theme": "dev-master",
"tjventurini/tags": "dev-master",
"tjventurini/articles": "dev-master",
"tjventurini/portfolio": "dev-master",
"tjventurini/contact": "dev-master",
"tjventurini/sunshine": "dev-master"
},
"require-dev": {
"filp/whoops": "~2.0",
"fzaninotto/faker": "~1.4",
"mockery/mockery": "~1.0",
"phpunit/phpunit": "~6.0",
"symfony/thanks": "^1.0"
},
"autoload": {
"classmap": [
"database/seeds",
"database/factories"
],
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"scripts": {
"post-root-package-install": [
"#php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"#php artisan key:generate"
],
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"#php artisan package:discover"
]
},
"config": {
"preferred-install": "dist",
"sort-packages": true,
"optimize-autoloader": true
}
}
composer did manage to create symlinks in the vendor directory for the tags and mini-bootstrap-theme packages before I added the other packages.
Also I already added the minimum-stability setting already.
Thank you!
Thanks to the comment of #Norman-N I could find an Answer very quickly. As he pointed out, I had to use aliases to use dev-master as a specific version/tag.
Here is a link to the composer documentation
I changed my composer.json as shown below.
"tjventurini/articles": "dev-master as 0.1.8",
"tjventurini/contact": "dev-master as 0.0.9",
"tjventurini/mini-bootstrap-theme": "dev-master as 0.0.3",
"tjventurini/portfolio": "dev-master as 0.0.17",
"tjventurini/sunshine": "dev-master as 0.2.10",
"tjventurini/tags": "dev-master as 0.0.9"

The requested amz/amazon-pay-module could not be found in any version, there may be a typo in the package name

I am trying to install a website from server to localhost. When I run the command composer update in git-bash then I get the following error. Please check the screenshot.enter image description here
All the other modules got installed properly only these three are causing issue.
I have checked several threads similar to this issue, found many answers but none worked in my case.
Here is my composer.json file
{
"name": "magento/project-community-edition",
"description": "eCommerce Platform for Growth (Community Edition)",
"type": "project",
"version": "2.1.11",
"license": [
"OSL-3.0",
"AFL-3.0"
],
"require": {
"magento/product-community-edition": "2.1.12",
"composer/composer": "#alpha",
"magepal/magento2-customshippingrate": "^1.3",
"mestrona/magento-module-categoryredirect": "^2.1",
"amzn/amazon-pay-and-login-with-amazon-core-module": "1.2.5",
"amzn/login-with-amazon-module": "1.2.5",
"amzn/amazon-pay-module": "1.2.5"
},
"require-dev": {
"phpunit/phpunit": "4.1.0",
"squizlabs/php_codesniffer": "1.5.3",
"phpmd/phpmd": "#stable",
"pdepend/pdepend": "2.4.0",
"fabpot/php-cs-fixer": "~1.2",
"lusitanian/oauth": "~0.3 <=0.7.0",
"sebastian/phpcpd": "2.0.0"
},
"config": {
"use-include-path": true
},
"autoload": {
"psr-4": {
"Magento\\Framework\\": "lib/internal/Magento/Framework/",
"Magento\\Setup\\": "setup/src/Magento/Setup/",
"Magento\\": "app/code/Magento/"
},
"psr-0": {
"": "app/code/"
},
"files": [
"app/etc/NonComposerComponentRegistration.php"
]
},
"autoload-dev": {
"psr-4": {
"Magento\\Sniffs\\": "dev/tests/static/framework/Magento/Sniffs/",
"Magento\\Tools\\": "dev/tools/Magento/Tools/",
"Magento\\Tools\\Sanity\\": "dev/build/publication/sanity/Magento/Tools/Sanity/",
"Magento\\TestFramework\\Inspection\\": "dev/tests/static/framework/Magento/TestFramework/Inspection/",
"Magento\\TestFramework\\Utility\\": "dev/tests/static/framework/Magento/TestFramework/Utility/"
}
},
"minimum-stability": "alpha",
"prefer-stable": true,
"repositories": [
{
"type": "composer",
"url": "https://repo.magento.com/"
}
],
"extra": {
"magento-force": "override"
}
}
If anyone have any idea then please guide me in the right direction. I am really stuck into it.
Please install amz-pay the latest extension which supports php latest version.Instead of, installing from composer please put through files.

Loading a composer package through a Github fork

I forked a library on Github and now want to load my fork into the project without adding the forked library into packagist. I get the following error after adding the repository and require to my composer.json:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- The requested package cnizzardini/ssl-certificate could not be found in any version, there may be a typo in the package name.
Potential causes:
- A typo in the package name
- The package is not available in a stable-enough version according to your minimum-stability setting
see <https://getcomposer.org/doc/04-schema.md#minimum-stability> for more details.
Here is my full composer.json
{
"name": "cakephp/app",
"description": "CakePHP skeleton app",
"homepage": "http://cakephp.org",
"type": "project",
"license": "MIT",
"require": {
"php": ">=5.5.9",
"cakephp/cakephp": "~3.4",
"mobiledetect/mobiledetectlib": "2.*",
"cakephp/migrations": "~1.0",
"cakephp/plugin-installer": "*",
"guzzlehttp/guzzle": "^6.2",
"donatj/phpuseragentparser": "^0.7.0",
"cnizzardini/ssl-certificate": "dev-master"
},
"require-dev": {
"psy/psysh": "#stable",
"cakephp/debug_kit": "~3.2",
"cakephp/bake": "~1.1",
"phpunit/phpunit": "^5.5"
},
"suggest": {
"phpunit/phpunit": "Allows automated tests to be run without system-wide install.",
"cakephp/cakephp-codesniffer": "Allows to check the code against the coding standards used in CakePHP."
},
"autoload": {
"psr-4": {
"App\\": "src",
"Api\\": "./plugins/Api/src",
"Channel\\": "./plugins/Channel/src",
"System\\": "./plugins/System/src",
"Admin\\": "./plugins/Admin/src"
}
},
"autoload-dev": {
"psr-4": {
"App\\Test\\": "tests",
"Cake\\Test\\": "./vendor/cakephp/cakephp/tests",
"Api\\Test\\": "./plugins/Api/tests",
"Channel\\Test\\": "./plugins/Channel/tests",
"System\\Test\\": "./plugins/System/tests",
"Admin\\Test\\": "./plugins/Admin/tests"
}
},
"scripts": {
"post-install-cmd": "App\\Console\\Installer::postInstall",
"post-create-project-cmd": "App\\Console\\Installer::postInstall",
"post-autoload-dump": "Cake\\Composer\\Installer\\PluginInstaller::postAutoloadDump"
},
"repositories": [
{
"type": "vcs",
"url": "https://github.com/cnizzardini/ssl-certificate.git"
}
],
"minimum-stability": "stable",
"prefer-stable": true
}
I have tried adding https://github.com/cnizzardini/ssl-certificate with and without the .git. I have also tried setting minimum-stability to dev and prefer-stable to false.
Nothing works :-(
The composer.json file on your fork still calls the package "spatie/ssl-certificate", so that's the name of the package you need to require.
This should work:
{
...
"require": {
...
"spatie/ssl-certificate": "dev-master"
},
...
"repositories": [
{
"type": "vcs",
"url": "https://github.com/cnizzardini/ssl-certificate.git"
}
],
...
}
If it doesn't, you can rename the package on your own fork by changing the name property in its composer.json file:
{
"name": "cnizzardini/ssl-certificate",
"description": "A class to easily query the properties of an ssl certificate ",
...
}

Composer Installation in windows Error

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"
}
}

Resources