Class 'yii\jui\DatePicker' not found (yii2 basic) - php

I downloaded the yii2-jui in this link
yii2-jui
After that I put it under yiisoft folder
yiisoft\yii2-jui
when I run my application it gives me this error
PHP Fatal Error – yii\base\ErrorException
Class 'yii\jui\DatePicker' not found
How can I fixed this.where should I put the yii2-jui folder ?
Thank you in advance

I fixed the problem when I ran
sudo composer require --prefer-dist yiisoft/yii2-jui "*"
ONLY IN FOLDER basic, where are web, yii, models and etc.

Insert this in the view:
use yii\jui\DatePicker;
The best way is: run: php composer.phar require --prefer-dist yiisoft/yii2-jui "*" in your project

insert code:
'yiisoft/yii2-jui' =>
array (
'name' => 'yiisoft/yii2-jui',
'version' => '2.0.2',
'alias' =>
array (
'#yii/jui' => $vendorDir . '/yiisoft/yii2-jui',
),
),
in yiisoft/extensions.php file

Stop creating duplicate questions.
And you do not just download something and copy it in a folder. Use composer to install it. the Yii2 that you copied is just a shell, you have to use composer to install the rest of it. Composer does more then just copy the files it creates an autoloader that tells yii where everything is.

Related

I'am getting an error --- In ProviderRepository.php line 208: Class 'Tymon\JWTAuth\Providers\LaravelServiceProvider' not found

I'am new to laravel, and this is my first question because I could not find a solution anywhere.
I implemented JWT-token somehow and it worked until I mess it up. Now when I type php artisan serve I get that error, or when I try to publish. I tried everything like in question --- Laravel 5.6.26 Error- Class 'Tymon\JWTAuth\Providers\LaravelServiceProvider' not found --- but it won't work.
When I add in composer.json "tymon/jwt-auth": "^0.5.12" I get an error class LaravelServiceProvider not found, and when I change it to "tymon/jwt-auth": "^1.0.0-beta.3" or "tymon/jwt-auth": "^1.0.0-rc.2" then I ger error JWTAuthServiceProvider not found. I also tried composer require illuminate/auth but it won't work. Can I get some help please.
I had this same issue and I solved it by executing these commands
composer require illuminate/auth
composer require tymon/jwt-auth:"^1.0.0-rc.2"
composer update
Then
php artisan vendor:publish --provider="Tymon\JWTAuth\Providers\JWTAuthServiceProvider"
You can safely remove from your app.php file
Tymon\JWTAuth\Providers\JWTAuthServiceProvider::class,
'JWTAuth' => Tymon\JWTAuth\Facades\JWTAuth::class,
'JWTFactory' => Tymon\JWTAuth\Facades\JWTFactory::class
You need to also add the alias to config/app.php like so:
'providers' => [
Tymon\JWTAuth\Providers\JWTAuthServiceProvider::class,
],
'aliases' = [
....
//other aliases
...
'JWTAuth' => Tymon\JWTAuth\Facades\JWTAuth::class,
'JWTFactory' => Tymon\JWTAuthFacades\JWTFactory::class`
]
and then include it at the top of the PHP file you want to use it in, like
use JWTAuth;
Try to delete config.php file from bootstrap/cache folder, it worked with me

Class 'dosamigos\ckeditor\CKEditor' not found

I am working on a project in Yii2 where I need to integrate CKEditor. I used this to install it:
composer require 2amigos/yii2-ckeditor-widget
It downloads the library files under /vendor directory. When I copied the files from local to server and used this:
use dosamigos\ckeditor\CKEditor;
<?= $form->field($userSurveyConfig,
'survey_email_body')->widget(CKEditor::className(),
['options' => ['rows' => 6],'preset' => 'basic'])
?>
When I run the page, this error pops up:
> Class 'dosamigos\ckeditor\CKEditor' not found
What i am doing wrong here? Any help?
Copy composer.json file to server and run composer update on server.

How to fix Class 'PDF' not found in laravel

Encountered the following error in My Laravel app:
FatalErrorException in CollaboPDFController.php line 14: Class 'PDF' not found
This is my CollaboPDFController.php:
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use PDF;
class CollaboPDFController extends Controller
{
public function getPDF(){
$pdf = PDF::loadView('customer.customer'); //line 14
return $pdf->download('customer.customer');
}
//
}
How I can fix this?
You are using the wrong import. To use the PDF you want (probably laravel-dompdf) use:
use Barryvdh\DomPDF\Facade as PDF;
If you put 'PDF' => Barryvdh\DomPDF\Facade::class, in your config/app.php you could also use:
use \PDF;
or
\PDF::loadView('customer.customer');
First you have to require DOMPDF package
Step 1 :
composer require barryvdh/laravel-dompdf
Step 2 : In ..\config\app.php
'providers' => [
.....
Barryvdh\DomPDF\ServiceProvider::class,
],
'aliases' => [
.....
'PDF' => Barryvdh\DomPDF\Facade::class,
]
Step 3 :
use \PDF;
Step 4 :
$pdf = PDF::loadView('pdf.report');
return $pdf->stream('report.pdf', array('Attachment' => 0));
You can run following commands after installing dompdf and set service provider and aliases in this file config/app.php
php artisan cache:clear and php artisan config:cache
Run the below command
composer require barryvdh/laravel-dompdf
In my case, I tried some of the examples above, but nothing worked.
However, I browsed the directory of the package located here:
project-folder>vendor>barryvdh>laravel-dompdf>src>Facade>Pdf.php
and I realized that the PDF alias created in the file >> app.php does not use the correct class.
So replace:
'aliases' => [
.....
'PDF' => Barryvdh\DomPDF\Facade::class,
]
by:
'aliases' => [
.....
'PDF' => Barryvdh\DomPDF\Facade\Pdf::class,
]
I hope this will help you.
finally got the solutions actually it was My domPDF installation problem I find out it this way
php artisan cache:clear
// and
php artisan config:cache
and install domPDF again
this is problem with cache config.php within bootstrap folder.
shared hosting does not show full path of your [project folder]in shared hosting and if you want clear cache , you have to purchase their plugins. by the given solution you have no need to purchase any plugin or no need to clear / config cache of laravel 5.6 or more.
hit the URl in your browser it will give you error log. now oprn your error log and copy the path from the error log.
change all file paths in config.php of [your project folder ]/bootstrap/cache, [your project folder ]\bootstrap\cache or [your project folder ]* etc by the full path copied from error log like /mnt/stor2-wc1-dfw1/411797/622471/[yourdomain]/web/content/[your project folder ]

omnipay pin payments with cake php 2.0

I need help regarding omnipay pin payments. i have no clue how to integrate this to cake php.
i tried this sample code but dint get success
$gateway = GatewayFactory::create('Pin');
$gateway->setSecretKey('your-secret-api-key');
$gateway->purchase([
'email' => 'customer#email.com',
'description' => 'Widgets',
'amount' => '4999',
'currency' => 'USD',
'card_token' => 'card_nytGw7koRg23EEp9NTmz9w',
'ip_address' => '1.2.3.4'
])->send();
Fatal error: Class 'GatewayFactory'
Please help me . Thanks in advance
You need to use Composer to install Omnipay. This is explained in the Omnipay Readme.
Make a file called composer.json in the root of your project directory:
{
"require": {
"omnipay/pin": "~2.0"
}
}
Then run the following commands in a terminal window:
$ curl -s http://getcomposer.org/installer | php
$ php composer.phar update
This will download the Omnipay files into your vendor/ directory.
Next, you will need to put the following line at the top of your index.php file, to register the composer autoloader:
require 'vendor/autoload.php';
Finally, you can use Omnipay in your project to create the Pin gateway:
$gateway = Omnipay\Omnipay::create('Stripe');

AWS SDK for Laravel giving PHP fatal error

I installed the https://github.com/aws/aws-sdk-php-laravel‎ SDK and followed the instructions in the readme.md. Everything installed, I put in my key, secret, region, etc. in the /app/config/packages/aws/aws-sdk-php-laravel.
The Error I'm Getting
PHP Fatal error: Class 'Aws\Common\Aws' not found in /Volumes/Data/Users/chris/Sites/ln.com/vendor/aws/aws-sdk-php-laravel/src/Aws/Laravel/AwsServiceProvider.php on line 48
{"error":{"type":"Symfony\\Component\\Debug\\Exception\\FatalErrorException","message":"Class 'Aws\\Common\\Aws' not found","file":"\/Volumes\/Data\/Users\/chris\/Sites\/ln.com\/vendor\/aws\/aws-sdk-php-laravel\/src\/Aws\/Laravel\/AwsServiceProvider.php","line":48}}
Line 48 of that file referenced above simply says:
$aws = Aws::factory($config);
I installed per the instructions
I put in my providers and aliases in /app/config/app.php with:
'Aws\Laravel\AwsServiceProvider'
in the providers array.
I put in:
'AWS' => 'Aws\Laravel\AwsFacade'
in the aliases section.
Then, I'm trying to use their same usage example:
$s3 = AWS::get('s3');
$s3->putObject(array(
'Bucket' => 'My Bucket',
'Key' => 'My Key',
'SourceFile'=> Config::get('settings.ProcessListings.image_dir') . $listing->mls_listing_id . "/test.txt"
));
What I've Tried
My only thoughts here were that in my file that I'm trying to use the SDK in, at the top I have:
use Illuminate\Console\Command;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;
I've added to that:
use Aws\Laravel\AwsFacade;
use Aws\Laravel\AwsServiceProvider;
and combinations of the two but neither work. Any ideas?
Your problem is in a class Aws\Common\Aws from aws/aws-sdk-php which is not available to composer (the autoloader). Those are steps that usually fix Laravel, when things like this happen and the problem is not on your source code, of course:
cd /your/application/dir
rm bootstrap/compiled.php
rm -rf vendor (or just rename your vendor folder to test)
composer update --no-dev
I know I am late but, I've come across this problem recently and I didn't want to remove my compiled packages. In my case, running php artisan config:cache was throwing that error. So what I did, I found Aws\\Laravel\\AwsServiceProvider in bootstrap/cache/services.php and removed them which solved the issue.

Categories