hallindavid / manny

a light-weight PHP package of useful common manipulators/formatters.
MIT License
37 stars 5 forks source link

Laravel * the package will not autoload after autodiscovery #9

Closed tommyz4 closed 3 years ago

tommyz4 commented 3 years ago

use Manny;

is not working, do you have any suggestions?

hallindavid commented 3 years ago

Try use \Manny; instead.

Make sure you do composer install

Any error messages or anything?

tommyz4 commented 3 years ago

Still no luck,

Ran composer require hallindavid/manny npm install npm run dev php artisan cache:clear

Still in my controller Manny class is not found,

use \Manny; use Manny;

class Patients extends Component { public $fid, $patients, $patient_id, $first_name, $last_name, $sex, $dob, $phone_number,$street_address,$city, $state, $zip_code, $middle_name; public $isOpen = 0;

// Get the currently authenticated user...

// Get the currently authenticated user's ID...

public function updated($field)
{
    if ($field == 'phone_number') {
       // this is where we will detect any changes to the phone field.
        $this->phone_number = Manny::stripper($this->phone_number, ['phone_number']);
    }

}

I don't see it added anywhere in app.php either in laravel.

tommyz4 commented 3 years ago

It appears to have installed?

[xxx@ip-xxx-beta]$ locate Manny /beta/vendor/hallindavid/manny/src/Manny /beta/vendor/hallindavid/manny/src/Manny/Crumble.php /beta/vendor/hallindavid/manny/src/Manny/Manny.php /beta/vendor/hallindavid/manny/src/Manny/Mask.php /beta/vendor/hallindavid/manny/src/Manny/Percent.php /beta/vendor/hallindavid/manny/src/Manny/Phone.php /beta/vendor/hallindavid/manny/src/Manny/PhoneHelper /beta/vendor/hallindavid/manny/src/Manny/Stripper.php /beta/vendor/hallindavid/manny/src/Manny/Yoink.php /beta/vendor/hallindavid/manny/src/Manny/PhoneHelper/Brack10.php /beta/vendor/hallindavid/manny/src/Manny/PhoneHelper/Brack10Ext.php /beta/vendor/hallindavid/manny/src/Manny/PhoneHelper/Brack11.php /beta/vendor/hallindavid/manny/src/Manny/PhoneHelper/Brack11Ext.php /beta/vendor/hallindavid/manny/src/Manny/PhoneHelper/Dashed10.php /beta/vendor/hallindavid/manny/src/Manny/PhoneHelper/Dashed11.php /beta/vendor/hallindavid/manny/src/Manny/PhoneHelper/Dot10.php /beta/vendor/hallindavid/manny/src/Manny/PhoneHelper/Dot11.php /beta/vendor/hallindavid/manny/src/Manny/PhoneHelper/Raw10.php ****/beta/vendor/hallindavid/manny/src/Manny/PhoneHelper/Raw11.php

hallindavid commented 3 years ago

Ok so this code here - I think you are using the stripper function incorrectly.

//Will take current phone_number value, remove all non-numeric characters, and then force into "xxx-xxx-xxxx" format
$this->phone_number = Manny::mask($this->phone_number, "111-111-1111");

//  or

// this will remove all non-numeric characters from the phone number field
$this->phone_number = Manny::stripper($this->phone_number, ['num']);

What kind of format are you looking for?

hallindavid commented 3 years ago

is it that Manny isn't found? or is it that the function isn't found?

like - do you have an error message possibly?

hallindavid commented 3 years ago

I hope the above worked - if not, let me know, but for now I'm going to close the issue.

bobweeman commented 1 year ago

Use Manny and Use \Manny still throws an error saying Class "Manny" not found.