I want to use Bcrypt of Laminas-Crypt package in one of my files. After running
composer require laminas/laminas-crypt,
composer dump-autoload,
composer update
I declared a use statement in my controller:
use Laminas\Crypt\Password\Bcrypt;
The application loaded without any errors, but as far as I am concerned, all namespaces should be registered in config/modules.config.php for the autoloader to load the namespaces accordingly. After adding Laminas\Crypt namespace to the folder the application threw an exception:
Uncaught Laminas\ModuleManager\Exception\RuntimeException: Module (Laminas\Crypt) could not be initialized. in C:\xampp\htdocs\phpLessons\Shortly\vendor\laminas\laminas-modulemanager\src\ModuleManager.php:180
My question is:
Can the application function properly without the namespace of the used package being defined in the config/modules.config.php of root directory?
How can the exception be handled?
Edit:
Here is the relevant part of composer.json
"require": {
"php": ">=8.1.0",
"laminas/laminas-component-installer": "^3.0",
"laminas/laminas-development-mode": "^3.2",
"laminas/laminas-skeleton-installer": "^1.0",
"laminas/laminas-mvc": "^3.3.4",
"laminas/laminas-db": "^2.12.0",
"laminas/laminas-mvc-form": "^2.0.0",
"laminas/laminas-json": "^3.2",
"laminas/laminas-log": "^2.13.1",
"laminas/laminas-cli": "^1.1.1",
"laminas/laminas-mvc-i18n": "^1.2.0",
"laminas/laminas-mvc-plugins": "^1.1.0",
"laminas/laminas-mvc-middleware": "^2.0.0",
"laminas/laminas-session": "^2.10.0",
"laminas/laminas-di": "^3.2.2",
"laminas/laminas-view": "^2.25",
"laminas/laminas-form": "3.7",
"laminas/laminas-crypt": "^3.9",
"ext-pdo": "*",
"laminas/laminas-mail": "^2.20",
"doctrine/orm": "^2.14",
"doctrine/dbal": "^3.2",
"symfony/yaml": "^5.4",
"symfony/cache": "^5.4",
"doctrine/common": "^3.4",
"doctrine/doctrine-orm-module": "^5.3"
},
and modules.config.php from config/autoload:
return [
'Laminas\Cache',
'Laminas\Paginator',
'Laminas\Mail',
'Laminas\Mvc\Plugin\FilePrg',
'Laminas\Mvc\Plugin\FlashMessenger',
'Laminas\Mvc\Plugin\Identity',
'Laminas\Mvc\Plugin\Prg',
'Laminas\Session',
'Laminas\Mvc\Middleware',
'Laminas\Mvc\I18n',
'Laminas\Form',
'Laminas\I18n',
'Laminas\Log',
'Laminas\InputFilter',
'Laminas\Filter',
'Laminas\Hydrator',
'Laminas\Di',
'Laminas\Db',
'Laminas\Router',
'Laminas\Validator',
'Laminas\DeveloperTools',
'Laminas\Diactoros',
'DoctrineModule',
'DoctrineORMModule',
'Application',
'User',
'Pages',
];
Related
I am working on Symfony 6.1.12 after updating dependencies with the composer update command, I receive the above error when I do the symfony console make:entity command.
My composer.json file below
I tried to downgrade the doctrine/orm bundle as shown in this example but it don't work
{
"require": {
"php": ">=8.1",
"ext-ctype": "*",
"ext-iconv": "*",
"doctrine/annotations": "^1.0",
"doctrine/doctrine-bundle": "^2.7",
"doctrine/doctrine-migrations-bundle": "^3.2",
"doctrine/orm": "^2.14.1",
},
"conflict": {
"symfony/symfony": "*"
}
Could it be you dont have the Repository annotation above your entity definition?
#[ORM\Entity(repositoryClass: ProductRepository::class)]
class Product
{
}
i have added LIB yookassa to laravel/vendor/omnipay/yookassa, but after call
$gateway = Omnipay::create('YooKassa');
it was error Class '\Omnipay\YooKassa\Gateway' not found
The main composer.json (require section)
"omnipay/paypal": "*",
"omnipay/stripe": "*",
"omnipay/yookassa": "*",
"yoomoney/yookassa-sdk-php": "^2.4",
"hiqdev/omnipay-yandex-kassa": "^3.0",
"igor-tv/omnipay-yookassa": "^4.0",
Try first clear the cache
php artisan optimize:clear
after you need
composer install
I'm new to silex, and I've got a file that creates a few defines. This is its content:
<?php
namespace Config;
define('DS',DIRECTORY_SEPARATOR);
define('ROOT',realpath(__DIR__ . '/../..'));
define('CONFIG',ROOT.DS.'app'.DS.'config');
I'm trying to load it using my composer.json:
{
"require": {
"silex/silex": "~2.0",
"twig/twig": "^1.33",
"doctrine/dbal": "^2.5",
"symfony/twig-bridge": "^3.2",
"boxedcode/silex-knp-menu-service-provider": "^1.0",
"symfony/form": "^3.2",
"symfony/validator": "^3.2",
"symfony/config": "^3.2"
},
"autoload": {
"psr-4": {
"Models\\": "src/MyApp/Models/",
"Config\\": "src/MyApp/Config/"
}
}
}
The defines file is inside src/MyApp/Config/, so I therefore hoped this line would be enough to load the defines file in my index.php file:
use Config\Defines;
But... it seems not... Can anyone tell me how to load the defines file so that I can use my Config class again?
"require": {
"infusionsoft/php-sdk": "^1.2",
"laravel/lumen-framework": "5.1.*",
"vlucas/phpdotenv": "~1.0",
"barryvdh/laravel-debugbar": "^2.2",
"goaop/framework": "^2.0",
"php-http/httplug": "^1.1",
"infusionsoft/old-php-isdk": "*"
},
I'm trying to use the "infusionsoft/old-php-isdk" which is in the packagist composer repository but it's not specific to Laravel. I'm using an order controller and it's code that I picked up from another developer so he references the current (and working) "infusionsoft/php-sdk" as the following
"use infusionsoft\infusionsoft;"
What namespace do I call it if it has no namespace from the package?
Here's the original link to the composer package.
https://packagist.org/packages/infusionsoft/old-php-isdk
Am I missing something? Do I need to assign it a namespace? What and where would I put it?
I get the following error when executing Behat:
PHP Fatal error: Class 'Symfony\Component\Process\PhpExecutableFinder' not found
I don't know if its normal, but the PhpExecutableFinder is located within my composer.phar after php composer.phar update is called.
{
"require": {
"php": ">=5.4",
"ext-mcrypt": "*",
"slim/slim": "~2.0",
"slim/views": "0.1.*",
"twig/twig": "1.18.*",
"propel/propel": "~2.0#dev",
"zeflasher/propel2-geocodable-behavior": "dev-master",
"behat/behat": "3.0.*#stable",
"behat/mink": "1.6.*#stable",
"behat/mink-extension": "#stable",
"behat/mink-goutte-driver": "#stable",
"behat/mink-selenium2-driver": "#stable",
"peridot-php/leo": "~1.0"
},
"autoload": {
"classmap": ["website/", "vendor/"]
}
}
Is my current composer.json. Can anybody reproduce it? composer.phar is self-updated.
composer require symfony/process
That solved the issue. I don't know why its not included in behat.