@marco_1992 are you for some reason using Laravel 8? Looks like that package doesn't support Laravel 8 but only Laravel 7 and below.
ntimyeboah/laravel-database-trigger incompatible
Hello. I want to install the laravel-database-trigger package from ntimyeboah but i get this error message:
Could not find package ntimyeboah/laravel-database-trigger in any version matching your PHP version, PHP extensions and Composer version
This is the cutout of my composer.json file:
"require": {
"php": "^7.3|^8.0",
"fideloper/proxy": "^4.4",
"fruitcake/laravel-cors": "^2.0",
"guzzlehttp/guzzle": "^7.0.1",
"laravel-lang/lang": "~8.0",
"laravel/fortify": "^1.7",
"laravel/framework": "^8.12",
"laravel/tinker": "^2.5",
"santigarcor/laratrust": "^6.3",
"yajra/laravel-datatables-oracle": "^9.15"
},
"require-dev": {
"barryvdh/laravel-debugbar": "^3.5",
"beyondcode/laravel-query-detector": "^1.5",
"facade/ignition": "^2.5",
"fakerphp/faker": "^1.9.1",
"laravel/sail": "^0.0.5",
"mockery/mockery": "^1.4.2",
"nunomaduro/collision": "^5.0",
"phpunit/phpunit": "^9.3.3"
},
Does anyone know where the problem is?
@marco_1992 in fact, it only support Laravel 5.7 below: https://github.com/NtimYeboah/laravel-database-trigger/blob/master/composer.json#L20
I want to user this Package:
https://github.com/DariusIII/laravel-database-trigger
There is written that in the release of version 2.1 Laravel 8 is supported.
I am forgetting something?
Here is the composer.json file:
https://github.com/DariusIII/laravel-database-trigger/blob/master/composer.json
@marco_1992 what you are trying to install is a forked version from https://github.com/NtimYeboah/laravel-database-trigger
To do this, add this to your composer.json file:
{
...
"repositories": [
{
"type": "vcs",
"url": "https://github.com/DariusIII/laravel-database-trigger"
}
]
}
then run this on your terminal composer require DariusIII/laravel-database-trigger
I have tried it but get the same error as before :/
@marco_1992 you are clearly doing something wrong here, I just tried that now and everything was installed perfectly.
Can you try doing that on a fresh Laravel install?
I have tried it on a fresh Laravel install, but i get the same error. Does it matter at which position your code is added in the composer.json file?
Or do you add additional code in the file?
Here is my file:
{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"repositories": [
{
"type": "vcs",
"url": "https://github.com/DariusIII/laravel-database-trigger"
}
],
"require": {
"php": "^7.3|^8.0",
"fideloper/proxy": "^4.4",
"fruitcake/laravel-cors": "^2.0",
"guzzlehttp/guzzle": "^7.0.1",
"laravel/framework": "^8.12",
"laravel/tinker": "^2.5"
},
"require-dev": {
"facade/ignition": "^2.5",
"fakerphp/faker": "^1.9.1",
"laravel/sail": "^1.0.1",
"mockery/mockery": "^1.4.2",
"nunomaduro/collision": "^5.0",
"phpunit/phpunit": "^9.3.3"
},
"autoload": {
"psr-4": {
"App\": "app/",
"Database\Factories\": "database/factories/",
"Database\Seeders\": "database/seeders/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\": "tests/"
}
},
"scripts": {
"post-autoload-dump": [
"Illuminate\Foundation\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi"
],
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"@php artisan key:generate --ansi"
]
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true
},
"minimum-stability": "dev",
"prefer-stable": true
}
Hi @marco_1992 & @neilstee
Why do you want to use an (old) package to create a trigger?
It's easy to create a migration with db facade statement https://laravel.com/docs/8.x/database#running-a-general-statement
and this method works for mysql & postgresql which I use.
Can you give me an example how to use triggers with db facade? i thought the way and syntax with the package is easier?!
your migration
up()
DB::statement("CREATE TRIGGER your_tg_name ...
...
down()
DB::statement("DROP TRIGGER your_tg_name
....
@sr57 good point! I wasn't paying attention to the usage of the package but only to how to install it.
Hi @neilstee
I've noticed that this time you're getting a little off track, but you're doing a good job overall. Have a day and thanks for your helps to the community.
@sr57 what is that supposed to mean?!
The question here was he can't install a certain package and not "is this the best package for this task?".
Although it's good you have pointed that this package was not needed for a certain task, but I think my solution wasn't "off track".
And lastly, this is not a job. I'm helping the community using my time and effort so I think you should be kind with your words because every effort does count. It doesn't need to be measure or what.
But thanks, I'll be more "aware" to the question next time. 🙂
Whaoh !!!! comminication is always a difficult art ...
I'll wrote to be kind with you, to thank yo and it seems I hurt you ... APPOLOGIES ... english is not my mother language.
But thanks, I'll be more "aware" to the question next time
You answer to the question this time too, I never wrote or want to write other thing.
Do you want me to erase my post?
@sr57 all good mate! no need for apologies! we are all learning here and I'm glad people like you are willing to help the community! I've been seeing you answering questions here always.
Thank you both so much for your help. I think I will do it without a package.
But my original question would still be. Why can't I install the package?
@marco_1992 I have installed a fresh Laravel 8 and did what I suggest to you above and it all working fine.
I'm not sure if this helps but I'm using composer v2. What composer version you are running?
I am using Version 2.0.8
@marco_1992 how about your PHP version?
And I don't know why it doesn't work. I did a fresh new laravel 8 installation just like you did. And then I add the lines in my composer.json file
Hi @marco_1992
I did a fresh new laravel 8 installation
Ok
add the lines in my composer.json file
Please share your exact composer.json , the command you did and the error you got.
Here is my composer.json file:
{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"repositories": [
{
"type": "vcs",
"url": "https://github.com/DariusIII/laravel-database-trigger"
}
],
"require": {
"php": "^7.3|^8.0",
"fideloper/proxy": "^4.4",
"fruitcake/laravel-cors": "^2.0",
"guzzlehttp/guzzle": "^7.0.1",
"laravel/framework": "^8.12",
"laravel/tinker": "^2.5"
},
"require-dev": {
"facade/ignition": "^2.5",
"fakerphp/faker": "^1.9.1",
"laravel/sail": "^1.0.1",
"mockery/mockery": "^1.4.2",
"nunomaduro/collision": "^5.0",
"phpunit/phpunit": "^9.3.3"
},
"autoload": {
"psr-4": {
"App\": "app/",
"Database\Factories\": "database/factories/",
"Database\Seeders\": "database/seeders/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\": "tests/"
}
},
"scripts": {
"post-autoload-dump": [
"Illuminate\Foundation\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi"
],
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"@php artisan key:generate --ansi"
]
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true
},
"minimum-stability": "dev",
"prefer-stable": true
}
I run this command:
composer require DariusIII/laravel-database-trigger
And i got the following error message:
[InvalidArgumentException]
Package DariusIII/laravel-database-trigger has a PHP requirement
incompatible with your PHP version, PHP extensions and Composer
version
require [--dev] [--dry-run] [--prefer-source] [--prefer-dist] [--fixed] [--no-suggest] [--no-progress] [--no-update] [--no-install] [--no-scripts] [--update-no-dev] [-w|--update-with-dependencies] [-W|--update-with-all-dependencies] [--with-dependencies] [--with-all-dependencies] [--ignore-platform-req IGNORE-PLATFORM-REQ] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [--sort-packages] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--apcu-autoloader-prefix APCU-AUTOLOADER-PREFIX] [--] [<packages>]...
@marco_1992 so it is a PHP version issue.
@marco_1992 I would not suggest this but you can bypass this using --ignore-platform-reqs:
composer require DariusIII/laravel-database-trigger --ignore-platform-reqs
Now it works. Thank you!!
@marco_1992 but please be aware that you are ignoring the required version of PHP to use this package.
So I suggest upgrading your PHP if you have any trouble.
Okay. But I think, than I have to downgrade php because I think php 8 is the problem.
Please or to participate in this conversation.