Symfony2 + psliwa PHPPdf - php

I have installed pdliwa PHPPdf in my Symfony2, I was testing the examples in the route \vendor\psliwa\php-pdf\examples and all worked fine except one.
The one that isnt working is barcode.xml. When I try to test it this error msg appear:
FatalErrorException: Error: Class 'Zend\Barcode\Object\Code128' not found in
C:\xampp\htdocs\Symfony\vendor\psliwa\php-pdf\lib\PHPPdf\Core\Node\Barcode.php line 175
I have zendframework in my vendor folder.
Anyone knows whats the problem?

You have to update your composer.json file, adding zend-barcode and zend-validator (which is required by zend-barcode). Then it works.

Related

PHP Fatal error: Class 'WP_UnitTestCase' not found when trying to run test-sample

I am trying to initialize php unit testing with my wordpress plugin using phpunit. I am running xampp on windows. My xampp installation is also on my E: drive if that makes any difference. I am following along with this tutorial:
https://www.smashingmagazine.com/2017/12/automated-testing-wordpress-plugins-phpunit/
I have gotten to the part where I run
install-wp-tests.sh wordpress_test root '' localhost latest
I run that and it pops up and closes quickly, so I don't know if it is really working or not. I then try to run
phpunit tests/test-sample.php
and I get:
PHP Fatal error: Class 'WP_UnitTestCase' not found in E:\xampp\htdocs\wp-content\plugins\SRBC\tests\test-sample.php on line 11
Fatal error: Class 'WP_UnitTestCase' not found in E:\xampp\htdocs\wp-content\plugins\SRBC\tests\test-sample.php on line 11
I assume that means the install-wp-test.sh isn't installing correctly and it is missing those classes. Any ideas?
Ended up needing to install SVN for windows. Also had to add the mysqladmin.exe path to the PATH environment variable. Then finally needed this :
https://wordpress.stackexchange.com/questions/249402/error-when-setting-up-phpunit-tests-with-wp-cli-scaffold
And after all that and 3 hours! I got it to work correctly!
Hope this helps someone else.

MongoDb not found in ZF2 controller

I have few controllers in my zf2 project which work perfectly in the browser using apache and via command line.
However, I recently installed MongoDb so I can store some data using the driver found in (http://php.net/manual/en/set.mongodb.php)
My issue is, when I try to access the driver via controller + browser, I get the following message error in my apache logs :
PHP Fatal error: Class 'MongoDb\Driver\Manager' not found.
'MongoDb\Driver\Manager' is the namespace for this Driver.
If I execute some other controllers via command line, MongoDb works correctly.
Does anyone know why is this happening? I cannot see the issue :(
Thank you
I found that my php.ini was pointing to mongo.so instead of mongodb.so
That fixed the issue
http://php.net/manual/en/mongodb.installation.manual.php
Thank you for your help

Using pingpong sky module in laravel 5

i wonder why i'm get something like this when add pingpong sky module to project
i think, i already follow all instruction in pingpong sky installation
when i create module Auth in cmd i got message success
but when i try to access Auth module in browser by this url
http://localhost/skypp/public/auth
i got message error
FatalErrorException in Application.php line 575:
Class 'Modules\Auth\Providers\AuthServiceProvider' not found
i think some problem occur when create that module
so i tried again make new module,
but it's failed this time like in pict
[Symfony\Component\Debug\Exception\FatalErrorException]
Class 'Modules\Auth\Providers\AuthServiceProvider' not found
where i'm missing?
It's actually quite simple and I don't know why the module:make command doesn't integrate it...
Please run a composer dump-autoload so that it rescans the PSR-4 folder and you should be good to go :)

DoctrineExtensions looking in wrong directory

I'm using Doctrine ORM in my PHP project.
In one of my queries I'm using the 'COS' (cosine) and 'SIN' (sine) functions, in order to make this possible on Doctrine I have to add this to my entitymanager configuration:
$config->addCustomNumericFunction('COS', 'DoctrineExtensions\Query\Mysql\cos');
$config->addCustomNumericFunction('SIN', 'DoctrineExtensions\Query\Mysql\sin');
This works fine when I run it on my local PC + server.
But once I put the project on the online webserver I'm facing with these errors:
Fatal error: Class 'DoctrineExtensions\Query\Mysql\cos' not found in /home/USER/domains/USER.com/public_html/MYDIRECTORY/vendor/doctrine/orm/lib/Doctrine/ORM/Query/Parser.php on line 3418
Fatal error: Class 'DoctrineExtensions\Query\Mysql\sin' not found in /home/USER/domains/USER.com/public_html/MYDIRECTORY/vendor/doctrine/orm/lib/Doctrine/ORM/Query/Parser.php on line 3418
It's looking in the 'vendor\doctrine' directory instead of the 'vendor\beberlei\DoctrineExtensions' directory.
My composer contains:
"beberlei/DoctrineExtensions": "dev-master"
And the vendor autoloader contains:
'DoctrineExtensions\\' => array($vendorDir . '/beberlei/DoctrineExtensions/src')
Can anyone explain this to me... I tried adding a classloader, but still the same problem.
Localhost is working fine...
When adding sine and cosine functions to the entitymanager config I used:
$config->addCustomNumericFunction('COS', 'DoctrineExtensions\Query\Mysql\cos');
$config->addCustomNumericFunction('SIN', 'DoctrineExtensions\Query\Mysql\sin');
The solution above is working on a local PC + server.
When moving the project files to the webserver the above config won't work.
You have to change the first letter of the last word in the DoctrineExtensions namespace to uppercase, like this:
$config->addCustomNumericFunction('COS', 'DoctrineExtensions\Query\Mysql\Cos');
$config->addCustomNumericFunction('SIN', 'DoctrineExtensions\Query\Mysql\Sin');
Basically cos becomes Cos and sin becomes Sin .
Now it works on the online webserver. Finally got it working!

Laravel call to undefined method Config::get()

I installed an Oauth library for social media login in my demo project and it worked smoothly. After that i moved same code to my main project and got this error:
Call to undefined method Config::get()
at this line in routes.php
$config = \Config::get('socialogin::config');
I have already run composer update and published configurations of the installed library/package.
Please help me. Above code worked in demo project but not working in my main project. Both projects have same version i.e. 4.2.16
Thanks
This line did the trick
use Illuminate\Support\Facades\Config;
I added above line at top of routes.php and it worked just fine.

Categories