ali_254
-
Posts
97 -
Joined
-
Last visited
Posts posted by ali_254
-
-
-
I deleted the composer and reinstalled it. The problem is solved!
-
Quote
In this tutorial, he first downloads the "DLL" file and then downloads it with Composer.Then, to connect to Mango, it is added to the project by Composer.
I don't know what codes I should use to connect to the "dll" file -
2 hours ago, requinix said:
MongoClient was removed in mongodb 1.0.0. That was back in 2015.
If I use the "dll" file, is there no need to install the driver using Composer?
-
On 10/9/2022 at 4:14 PM, maxxd said:
It's not a private repository and the composer.json file you've posted doesn't define any additional repository sources, so I'm not really sure why it's throwing that error at you to be honest.
I have this problem with the "composer require mongodb/mongodb" package as well.
Internet in Iran is severely limited. I really don't know what to do. No package can be installed with Composer.😡😡
-
10 hours ago, requinix said:
Whatever you found that talks about "MongoClient" is out of date. There is no such class - not anymore.
Is this class deprecated from PHP version 8?
-
<?php try { // connect to OVHcloud Public Cloud Databases for MongoDB (cluster in version 4.4, MongoDB PHP Extension in 1.8.1) $m = new MongoDB\Driver\Manager('mongodb://localhost:27017'); echo "Connection to database successfully"; // display the content of the driver, for diagnosis purpose var_dump($m); } catch (Throwable $e) { // catch throwables when the connection is not a success echo "Captured Throwable for connection : " . $e->getMessage() . PHP_EOL; }
Solved, thanks
- 1
-
hi.i installed mongodb and install "driver mongodb for php" from pecl.php.net.
when run this code , I am getting the error " Fatal error: Uncaught Error: Class "MongoClient" not found".
<?php $m = new MongoClient(); echo "Connection to database successfully"; // select a database $db = $m->examplesdb; echo "Database examplesdb selected";
-
38 minutes ago, ginerjm said:
Could you be more descriptive as to what you are looking for? Modular programming can mean so many different things.
for example , In the Laravel framework, there is the ability to add different packages.Codes that perform new behavior can be added without changing the core of the framework.
I want to write modular programs with pure PHP. The codes are independent and can be increased or decreased.
-
hi.
Do you know of a free tutorial on "modular programming" in PHP that you can introduce? Thanks
-
Quote
have you tried manually requiring it with `composer require carlos-meneses/laravel-mpdf`?
Yes, but I got this error:
Cloning failed using an ssh key for authentication, enter your GitHub credentials to access private repos
-
23 hours ago, maxxd said:
You're saying that carlos-meneses/laravel-mpdf is timing out? Maybe it was a glitch with packagist - it's doing fine here. There's only two additional packages it looks like.
Now that you've removed it from the composer.json file, have you tried manually requiring it with `composer require carlos-meneses/laravel-mpdf`?
I receive this message
Cloning failed using an ssh key for authentication, enter your GitHub credentials to access private repos
-
I removed the mpdf package in composer.json...Composer has been successfully updated.
Now it is only with the problem with mpdf
-
I use these packages:
{ "name": "laravel/laravel", "type": "project", "description": "The Laravel Framework.", "keywords": ["framework", "laravel"], "license": "MIT", "require": { "php": "^7.3|^8.0", "bumbummen99/shoppingcart": "^4.2", "carlos-meneses/laravel-mpdf": "^2.1", "fruitcake/laravel-cors": "^2.0", "guzzlehttp/guzzle": "^7.0.1", "hekmatinasser/verta": "^2.1", "intervention/image": "^2.7", "laravel/framework": "^8.75", "laravel/sanctum": "^2.11", "laravel/tinker": "^2.5" }, "require-dev": { "barryvdh/laravel-debugbar": "^3.6", "facade/ignition": "^2.5", "fakerphp/faker": "^1.9.1", "laravel/sail": "^1.0.1", "mockery/mockery": "^1.4.4", "nunomaduro/collision": "^5.10", "phpunit/phpunit": "^9.5.10" }, "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-update-cmd": [ "@php artisan vendor:publish --tag=laravel-assets --ansi --force" ], "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 have access to GitHub.
Laravel itself has a large number of packages. Do I have to download all the desired packages individually?
-
Just now, requinix said:
Operation timed out
Try again?
Yes, I tried several times.
Is there another way to update the package without using the terminal?
Due to the spread of protests in Iran, the internet is severely limited and filtered, and I have to use a VPN.
If you have a solution, please tell. Thanks
-
hi , i want update composer but I receive this message:
QuoteCloning failed using an ssh key for authentication, enter your GitHub credentials to access private repos
When working with _public_ GitHub repositories only, head to https://github.com/settings/tokens/new?scopes=&description=Composer+on+DESKTOP-C3HMN8R+2022-10-06+1038 to retrieve a token.
This token will have read-only permission for public information only.
When you need to access _private_ GitHub repositories as well, go to https://github.com/settings/tokens/new?scopes=repo&description=Composer+on+DESKTOP-C3HMN8R+2022-10-06+1038
Note that such tokens have broad read/write permissions on your behalf, even if not needed by Composer.
Tokens will be stored in plain text in "C:/Users/ali/AppData/Roaming/Composer/auth.json" for future use by Composer.
For additional information, check https://getcomposer.org/doc/articles/authentication-for-private-packages.md#github-oauthi register a token in github and enter in command prompt but receive this message:
curl error 28 while downloading https://api.github.com/: Operation timed out after 10004 milliseconds with 0 out of 0 bytes received
Please give a solution. Thank you
-
On 9/7/2022 at 11:38 PM, mjb012 said:
Will you please let me how you find the problem ?
i install last veraion of xamp and The problem was solved
-
-
53 minutes ago, maxxd said:
<?php namespace App\Models; use Illuminate\Contracts\Auth\MustVerifyEmail; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Foundation\Auth\User as Authenticatable; use Illuminate\Notifications\Notifiable; use Laravel\Sanctum\HasApiTokens; class Admin extends Authenticatable { use HasApiTokens; use HasFactory; use Notifiable; /** * The attributes that are mass assignable. * * @var array */ // protected $fillable = [ // 'name', // 'email', // 'password', // ]; protected $guarded = []; /** * The attributes that should be hidden for arrays. * * @var array */ protected $hidden = [ 'password', 'remember_token', 'two_factor_recovery_codes', 'two_factor_secret', ]; /** * The attributes that should be cast to native types. * * @var array */ protected $casts = [ 'email_verified_at' => 'datetime', ]; /** * The accessors to append to the model's array form. * * @var array */ protected $appends = [ 'profile_photo_url', ]; }
When I create a guard, which middleware should I use? Have I chosen the right middleware?
After logging in, Returns the details of the admin table:
if(Auth::guard('admin')->attempt($credentials)) { dd (Auth::guard('admin')->user()); //return true
But in the controller on which I applied middleware it returns null
-
hi.
I created a guard with the name "admin".
'guards' => [ 'web' => [ 'driver' => 'session', 'provider' => 'users', ], 'admin' => [ 'driver' => 'session', 'provider' => 'admins', ], ], 'providers' => [ 'users' => [ 'driver' => 'eloquent', 'model' => App\Models\User::class, ], 'admins' => [ 'driver' => 'eloquent', 'model' => App\Models\Admin::class, ], ],
and login with method attempt:
if(Auth::guard('admin')->attempt($credentials)) { $request->session()->regenerate(); return redirect()->route('admin.index'); }
And I have assigned a Middlewareto the Route:
Route::prefix('dashboard/admin/brand')->middleware(['auth:admin'])->group(function () { Route::get('/view', [BrandController::class, 'BrandView'])->name('all.brand'); }
But when I want to access the properties of Guard Admin, it returns null:
class BrandController extends Controller { public function __construct() { dd (Auth::guard('admin')->user()); //return null dd (Auth::guard('admin')->guest()); // return true } {
What is the problem?
-
hi..
I defined a guard and named admin.
Authenticate middleware works with Guard Web(default).
Should I change it (Authenticate middleware) to match Guard Admin or create a new middleware for Guard Admin? Thanks
-
4 hours ago, Barand said:
Try TCPDF.
It's FPDF with lots of extras. I haven't tried it with Farsi but it handles Arabic well, unlike FPDF.
Thanks, does this library only work with Composer?
Can work with it without composer?
-
hi...
I used FPDF, but it does not support Farsi language...
Do you have a solution?
-
hi.I used this code in my program
dd(auth()->guard('admin')->user());
When I write this code in the blade files, it returns a value.
But if I write it in the controllers, it returns an empty value! it's strange!
Can anyone tell me what the problem is? I'm confused!
Modular programming in PHP (tutorial )
in PHP Coding Help
Posted
https://www.freelancer.com/community/articles/6-creative-techniques-for-writing-modular-code
It is mentioned on this site, but I would like a full tutorial