Support the ongoing development of Laravel.io →
Authentication Mail
Last updated 2 years ago.
0

Can we see you composer.json file?

Last updated 2 years ago.
0

Did you add the folders to the autoloader? Did you run composer dump-autoload?

Last updated 2 years ago.
0

Yes, I guess I did, here's the content of my composer.json file

{
	"name": "laravel/laravel",
	"description": "The Laravel Framework.",
	"keywords": ["framework", "laravel"],
	"license": "MIT",
	"require": {
		"laravel/framework": "4.2.*",
		"creolab/laravel-modules": "dev-master",
		"cartalyst/sentry": "2.1.*"
		
	},
	"require-dev": {
		"way/generators": "dev-master"
	},
	"autoload": {
		"classmap": [
			"app/commands",
			"app/controllers",
			"app/models",
			"app/database/migrations",
			"app/database/seeds",
			"app/tests/TestCase.php",

			"app/modules"
		],
		"psr-0": {
			"Prolife\\": "app/prolife"
		}
	},
	"scripts": {
		"post-install-cmd": [
			"php artisan clear-compiled",
			"php artisan optimize"
		],
		"post-update-cmd": [
			"php artisan clear-compiled",
			"php artisan optimize"
		],
		"post-create-project-cmd": [
			"php artisan key:generate"
		]
	},
	"config": {
		"preferred-install": "dist"
	},
	"minimum-stability": "stable"
}
Last updated 2 years ago.
0
"psr-0": {
    "Prolife": "app/"
}

What you are using is psr-4

and run "composer dump-autoload" after

Last updated 2 years ago.
0

Thanks pogachar, I rolled back to psr-0 but the problem persists

ReflectionException (-1) 
Class Prolife\Events\MailSender does not exist
Last updated 2 years ago.
0
Solution

It worked now, it was a namespacing problem

first I used psr-4

"psr-4": {
			"Prolife\\": "app/prolife"
		}

I changed my Mailer class namespace to the following

<?php namespace Prolife\Mailers;

I also changed the namespace in the observers.php file

Event::listen('send.mail', 'Prolife\Events\MailSender@sendTo');

And finally my MailSender class has now the following namespace

<?php namespace Prolife\Events;

THANK YOU GUYS!

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

teeyo teeyo Joined 14 Mar 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.