Comments (9)
Just to give you more details, this is what i get when i do not use any "use" statement at the top since you are not saying we should use any.
[2018-07-10 02:54:44] local.ERROR: Class 'App\Http\Controllers\API\LasseRafn\InitialAvatarGenerator\InitialAvatar' not found {"userId":1,"email":"[email protected]","exception":"[object] (Symfony\Component\Debug\Exception\FatalThrowableError(code: 0): Class 'App\Http\Controllers\API\LasseRafn\InitialAvatarGenerator\InitialAvatar' not found at D:\WebServer\ZeinTekWebServices\liveroot\Merlin Core\app\Http\Controllers\API\ContactsIndividualsController.php:916)
[stacktrace]
My controller is in a folder called API, not at the root where default controllers are located.
I'm using laravel 5.5 btw.
What am i doing wrong please?
from php-initial-avatar-generator.
you either have to call the class this way : \LasseRafn\InitialAvatarGenerator\InitialAvatar
or with the use
statement at top of your class.
from php-initial-avatar-generator.
Hello Warlof, i tried that as well last night doing this:
use LasseRafn\InitialAvatarGenerator\InitialAvatar; (at the top of my controller)
and this in the function:
$avatar = new LasseRafn\InitialAvatarGenerator\InitialAvatar();
$imageData = $avatar ->name('Lasse Rafn')
->length(2)
->background('#8BC34A')
->generate();
But i still get an error, this one:
[2018-07-10 11:45:31] local.ERROR: Class 'App\Http\Controllers\API\LasseRafn\InitialAvatarGenerator\InitialAvatar' not found {"userId":1,"email":"[email protected]","exception":"[object] (Symfony\Component\Debug\Exception\FatalThrowableError(code: 0): Class 'App\Http\Controllers\API\LasseRafn\InitialAvatarGenerator\InitialAvatar' not found at D:\WebServer\ZeinTekWebServices\liveroot\Merlin Core\app\Http\Controllers\API\ContactsIndividualsController.php:916)
[stacktrace]
I think it is because i have my controllers not at the root but in a folder called "API" but i don't see why it doesn't work, my other classes are good and this class is in the vendor section. Any ideas?
from php-initial-avatar-generator.
that wasn't what I wrote upper.
either one or the other; not a mix of both.
if you're not using the use
statement; you should write :
$var = new \Namespace\Class();
if you're using the use
statement; you should write :
$var = new Class();
That's PSR4 and PHP basics :/
from php-initial-avatar-generator.
so i don't use this line then?
$avatar = new LasseRafn\InitialAvatarGenerator\InitialAvatar();
How do i instantiate a new avatar then?
$avatar = InitialAvatar::????
Please i know i am close.
Thank you in advance.
from php-initial-avatar-generator.
<?php
namespace App\Http\Controllers;
use Illuminate\Routing\Controller;
use LasseRafn\InitialAvatarGenerator\InitialAvatar;
class AbstractController extends Controller
{
public function get()
{
$avatar = new InitialAvatar();
$avatar->name('Warlof Tutsimo')->size(32)->rounded()->generate();
}
}
from php-initial-avatar-generator.
Thanks a million!!!!!!!!!!!!!!!! You are wonderful Loic. Much appreciated. Have a wonderful day.
from php-initial-avatar-generator.
I'll build a Laravel wrapper soon 👍
from php-initial-avatar-generator.
Coming up: https://github.com/Rackbeat/laravel-ui-avatars
from php-initial-avatar-generator.
Related Issues (20)
- Document `keepCase`
- Document use-case against CSS HOT 1
- No way to use Imagick as driver? HOT 4
- Broken Return HOT 3
- Result output HOT 6
- Turkish Characters
- Saving the generated image HOT 2
- Laravel Wrapper HOT 1
- SVG support ? HOT 2
- generate random color HOT 4
- Set image height HOT 1
- Installation failed HOT 1
- Gradient Colors HOT 1
- [FEAT] Emoji/emoticon support
- Initials are not centered HOT 1
- [Regression] SVGs not resizing in IE11
- PHP 8 Support HOT 11
- FontAwesome only user icon works HOT 1
- Deprecation Notice: Dynamic property creation in InitialAvatar.php with php 8.2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from php-initial-avatar-generator.