Laravel 5 and Flysystem - laravel-5

I installed the extension https://github.com/GrahamCampbell/Laravel-Flysystem. I need to work with the cloud (Dropbox). I set up parameters for flysystem.php Dropboks. But when I try to send a file - an error.
use Illuminate\Support\Facades\App;
...
Flysystem::connection('dropbox')->put('test222.txt', 'bar');
FatalErrorException in DropboxConnector.php line 69: Class 'Dropbox\Client' not found
http://clip2net.com/s/3l0Hwe1
What could be the problem?
Sorry for bad english and thank you!

Have you installed Dropbox adapter?
composer require league/flysystem-dropbox
This will then install Dropbox SDK for PHP which contain Dropbox\Client class.

Related

The Encrypt library requires the Mcrypt extension error

I am getting this error message in CI and I am using XAMPP:
An Error Was Encountered
The Encrypt library requires the Mcrypt extension.
I already look for other similar post but still have not found the right answer.
I try this adding this script in my php.ini XAMPP:
extension=php_mcrypt.dll
line 887.
and restart my xampp. but the same error still appears.
Thanks.
I was getting this error because i had switched from XAMPP(php5) to XAMPP(php7),
for this I replaced my old CI->system->libraries->encrypt.php with new file here:encrypt.php, and it worked.
In this new file we check if mcrypt_encrypt is supported or not in __construct function with code below
$this->_mcrypt_exists = ( ! function_exists('mcrypt_encrypt')) ? FALSE : TRUE;
and based on that we use different function between mcrypt_encode and _xor_encode like that.
Just to know, if you see this old file in __construct function you will see actual error checking
if (($this->_mcrypt_exists = function_exists('mcrypt_encrypt')) === FALSE)
{
show_error('The Encrypt library requires the Mcrypt extension.');
}
It worked for me.
It finally works after I move the server from PHP 7 to PHP 5 xampp server.

Unable to find PHPUnit\Framework\Constraint\Constraint in Laravel BrowserKit package after upgrade to 5.4

I'm upgrading an old Laravel personal project from 5.2 to 5.4. The upgrade to 5.3 seems to have gone OK, but now I'm moving to 5.4 I've run into an issue.
The project used the old testing layer so I've installed the BrowserKit testing package to maintain backward compatibility. I also created the following base test case for the Browserkit tests:
<?php
namespace Tests;
use Laravel\BrowserKitTesting\TestCase as BaseTestCase;
abstract class BrowserKitTestCase extends BaseTestCase
{
use CreatesApplication;
public $baseUrl = 'http://localhost';
}
The tests for the models, which use the normal test case, work fine, but when I run any of the tests that use the BrowserKit test case, I see the following error message:
PHP Fatal error: Class 'PHPUnit\Framework\Constraint\Constraint' not found in /home/matthew/Projects/myproject/vendor/laravel/browser-kit-testing/src/Constraints/PageConstraint.php on line 10
PHP Fatal error: Uncaught Illuminate\Contracts\Container\BindingResolutionException: Target [Illuminate\Contracts\Debug\ExceptionHandler] is not instantiable. in /home/matthew/Projects/myproject/vendor/laravel/framework/src/Illuminate/Container/Container.php:895
Stack trace:
#0 /home/matthew/Projects/myproject/vendor/laravel/framework/src/Illuminate/Container/Container.php(735): Illuminate\Container\Container->notInstantiable('Illuminate\\Cont...')
#1 /home/matthew/Projects/myproject/vendor/laravel/framework/src/Illuminate/Container/Container.php(608): Illuminate\Container\Container->build('Illuminate\\Cont...')
#2 /home/matthew/Projects/myproject/vendor/laravel/framework/src/Illuminate/Container/Container.php(575): Illuminate\Container\Container->resolve('Illuminate\\Cont...')
#3 /home/matthew/Projects/myproject/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(728): Illuminate\Container\Container->make('Illuminate\\Cont...')
#4 /home/matthew/Projects/myproject/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExce in /home/matthew/Projects/myproject/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 895
Google hasn't been much use with this and the error message is not terribly illuminating. It seems to be something to do with the namespace because the class PHPUnit\Framework\Constraint\Constraint doesn't appear to exist, but I'm not sure how to resolve the issue. I've upgraded the version of PHPUnit to 5.7 as necessary, but that doesn't resolve the issue. Can anyone suggest what the issue might be?
EDIT: Just thought to try downgrading the version to 1.0 and that seems to solve the problem for now, so maybe version 2.0 is intended to work with PHPUnit 6? Still, hopefully this post will help someone out in future.
I ran into this today also.
Instead of downgrading laravel/browser-kit-testing from ~2.0 to ~1.0, I upgraded "phpunit/phpunit" from 5.7 to ~6.0 and that fixed the problem.
I agree that it is related to the PHPUnit namespaces. There is a commit to laravel/browser-kit-testing from May 25 with a title of "Use PHPUnit 6.0 namespaced classes."
Downgrading laravel/browser-kit-testing to 1.0 seemed to resolve the issue, so I'm guessing it's something to do with the namespaces for PHPUnit.
I think you need to instruct your test runner to use the bootstrap autoloader file containing PHPUnit class aliases.
try
phpunit --bootstrap bootstrap/autoload_test.php
If you are using a phpunit.xml configuration file, make sure your phpunit tag contains bootstrap="bootstrap/autoload_test.php" amongst your other set options, like the following:
<phpunit bootstrap="bootstrap/autoload_test.php">
You can instruct your test runner to read your phpunit.xml like so:
phpunit --configuration phpunit.xml

Auth guard driver [api] is not defined?

I use this library jwt-auth-guard in Laravel 5.3.
When I try open page I get error:
InvalidArgumentException in AuthManager.php line 99:
Auth guard driver [api] is not defined.
How can I fix it? I made everything that was need
I'm not sure, please check you guard driver setup into config/auth.php first. You can cross check this from GIT repo.
Let me know if any concern from above.
If you are using tymondesigns/jwt-auth package first check that you are downloading the latest version (1.0.0-rc.2 for this time) or you can just update your composer
composer update
and also delete your old jwt file from config folder and publish again also run!
php artisan jwt:secret

Installing Riari/Laravel forum with composer - error - class not found

I am trying to install Riari forum for Laravel and I follow strictly the steps from http://teamteatime.net/docs/laravel-forum/3.x/installation.md
When I type php artisan vendor:publish in the console, it gives me this error:
[Symfony\Component\Debug\Exception\FatalErrorException]
Class 'Riari\Forum\ForumServiceProvider' not found
How can I fix it?
You need to put this (Riari\Forum\ForumServiceProvider) in Config/app.php inside service provider in the same format where already some providers are added

PHP Fatal error: A precedence rule was defined for > Illuminate\Foundation\Auth\AuthenticatesUsers::getGuard

I've just finished updating an app from Laravel 5.1 to 5.2. Everything is working fine on my local Homestead install. When I deploy to my forge server, the process is failing with the following error:
PHP Fatal error: A precedence rule was defined for
Illuminate\Foundation\Auth\AuthenticatesUsers::getGuard but this
method does not exist in
/home/forge/myapp/vendor/laravel/framework/src/Illuminate/Foundation/Auth/AuthenticatesAndRegistersUsers.php
on line 11
What could be causing this? I've tried running composer dump-autoload after the update, but still no luck.
Any advice appreciated.
I fixed this by deleting /bootstrap/cache/compiled.php. The files the error refers to were fine.
The AuthenticatesAndRegistersUsers has a precedence statement to use getGuard from AuthenticatesUsers instead of from RegistersUsers.
The AuthenticatesUsers trait has a getGuard method defined in it.
Double check to make sure your version of that trait has the getGuard method and or double check those traits against the ones in the laravel repository.

Resources