php


Class not found Die and Dump environment variable keys


I am going through a laravel tutorial and the section I am stuck on is called "The Service Container" Basically I just grab a environment variable and spit it out to the page with a dd() die and dump. However I get a class not found error. I know it must be a small bug, but cant quite figure it out. I tried running composer dump-autoload with no luck.
Here is my code
routes/web.php
App::bind('App\Billing\Stripe', function(){
return new \App\Billing\Stripe(config('services.stripe.secret'));
});
$stripe = App::make('App\Billing\Stripe');
dd($stripe);
app/billing/Stripe.php
namespace App\Billing;
class Stripe{
protected $key;
public function __construct($key){
$this->key = $key;
}
}
There is no need here for dump-autoload because you're creating a new namespace inside psr-4 confiugred folder app.
The solution is to rename the folder billing to a capital case, because laravel uses composer autoload following psr-4 standard which states that namespace matches the folder name in a case sensitive way.
Note : there are alternative autoloading schemes provided by composer that may need composer dump-autoload or editing composer.json when a new file is created

Related Links

Why does the is_logged_in() method run in my CodeIgniter app?
How to get $_SESSION value in the next php page with facebook sdk?
“page not found nginx/1.4.4” errors on every page except homepage
Can you do if/else logic in MYSQL statement?
php not resolving symbolic link
PHP Can't get variable from MySQL database
PHP MySQL UPDATE - no errors, but not updating
Getting error while listing in Yii2
CakePHP: Posting data from shell to controller
PHP include path: what am I doing wrong?
hidden field how to remove last part of url?
PHP <title> array in head only works partially
add database connection property to laravel
Cron increments minute interval by self
Assign multiple distinct Entities to one Array row in Doctrine
Setting up LAMP server, trouble with phpmyadmin "Cannot load or save configuration

Categories

HOME
opengl
office365
ionic2
user-interface
list
matrix
tomcat
shinyapps
bokeh
systemd
antd
compilation
elk-stack
ontology
cdi
yeoman-generator-angular
amazon-emr
mailmerge
grocery-crud
texas-instruments
cocos2d-android
varnish-vcl
codefluent
psql
cmake-gui
weex
jstree
prompt
crud
cube
boolean-logic
copy-protection
envoy
steam-web-api
riotjs
fotorama
xcrun
cucumber-junit
om-next
gsp
keyboard-layout
pdfnet
testlink
love2d
nanogallery
aurelia-cli
elastica
text-decorations
python-sounddevice
stat
oauth2-playground
type-inference
intellij-lombok-plugin
md5-file
sesame
yui3
s-function
system.web.optimization
msbuild-4.0
raw-sockets
dojo-build
node.js-connect
qpixmap
vimperator
i2b2
univocity
ioexception
lovefield
largenumber
auto-generate
enaml
knife
search-form
cache-manifest
python-c-extension
baseadapter
directorysearcher
password-recovery
code-complexity
commenting
thruway
cpu-time
lsa
pbkdf2
acitree
lru
hints
idispatch
jdom
flymake
fbml
background-repeat
boost-foreach
net-use
nsconnection
git-log

Resources

Encrypt Message