psr-4

Laravel error 'ReflectionException' - 'Class App\Http\Kernel does not exist'

混江龙づ霸主 提交于 2020-01-02 01:09:09
问题 I was trying to go live with a laravel project i developped a year back in school and i ran into some issue. After uploading the whole project on my hosting service's server, i got these errors on my browser as well as on my SSH shell. Fatal error: Uncaught exception 'ReflectionException' with message 'Class App\Http\Kernel does not exist' in /home/clients/ffa41f94063541f86a0fe6602a73caa1/myforms/vendor/laravel/framework/src/Illuminate/Container/Container.php:779 Stack trace: #0 /home/clients

Does PHP's use statement cause extra work when loading classes?

旧巷老猫 提交于 2019-12-23 13:57:07
问题 Code Sample 1 use Outline\Drawing; $var = new Drawing(); Code Sample 2 $var = new Outline\Drawing(); Question: Does PHP make hardware work harder (look up more files or do more processing) if I use code in sample 1? I am sure something gets done, even if it is at the level of some code that figures out which use line gets matched up with which class. I want to find out exactly what is happenning. In short: What does PHP do when working out the connection between the use of the use statement

PHP reserved keywords allowed in namespace? (public, private, default)

谁都会走 提交于 2019-12-22 17:47:24
问题 PhpStorm is highlighting the following namespace as an error. <?php namespace App\Http\Controllers\Public; Error: Expected: identifier In general. Are reserved keywords like public , function , class not acceptable for namespacing? 回答1: The PHP manual hints that as of PHP 7.0.0 these keywords are allowed as property, constant, and method names of classes, interfaces and traits, except that class may not be used as constant name , which also incorporate the requested keyword public . List of

Laravel, using packages with PSR-4 gives message “No hint path defined for”

廉价感情. 提交于 2019-12-22 09:03:49
问题 Im using Laravel 4.1 and starting a package (subby) that is using PSR-4 standard. When I try to render any view with: return View::make('subby::user.login'); I get the message: No hint path defined for [subby] I've red many things, but those were usually typo problems 回答1: The problem is in the usage of the PSR-4 Since Laravel default is PSR-0 it assumes that the resources (views etc) of a package will be 2 levels up from where the package service provider is. Ex: src ├── config ├── lang ├──

Laravel, using packages with PSR-4 gives message “No hint path defined for”

三世轮回 提交于 2019-12-22 09:02:15
问题 Im using Laravel 4.1 and starting a package (subby) that is using PSR-4 standard. When I try to render any view with: return View::make('subby::user.login'); I get the message: No hint path defined for [subby] I've red many things, but those were usually typo problems 回答1: The problem is in the usage of the PSR-4 Since Laravel default is PSR-0 it assumes that the resources (views etc) of a package will be 2 levels up from where the package service provider is. Ex: src ├── config ├── lang ├──

PSR-4 autoloading not working

可紊 提交于 2019-12-20 01:41:27
问题 I have created an app/modules directory and autoloaded it using PSR-4 like this: "psr-4": { "Modules\\": "app/modules" } And I also did composer dumpautoload . I have the following directory structure: app - ... - modules -- ModuleName --- controllers ---- BackendController.php ... The file BackendController.php has the namespace Modules\ModuleName\Controllers . And in routes.php , I have the following: Route::resource('backend/modules/module-name', 'Modules\ModuleName\Controllers

Composer PSR-4 autoloading “class not found” debug

好久不见. 提交于 2019-12-11 02:44:01
问题 Yes another question about the "class not found" error. Either I am missing something, or I misunderstood the PSR-4 logic. My composer library directory sturcture: "Scanner" => "src" => "Test.php" Test.php namespace MyNS; class Test { } composer.json "autoload": { "psr-4": { "MyNS\\": "src/" }, } So, now I load the library in my project with composer and try using it. require_once("../vendor/autoload.php"); $test = new MyNS\Test(); Which always results in "Fatal error: Uncaught Error: Class

Why using PSR4 autoload doesn't add any classes into classmap/namespaces file?

早过忘川 提交于 2019-12-08 15:44:43
I've got the following composer.json file: { "require-dev": { "queueit/KnownUser.V3.PHP": "dev-master" }, "repositories": [ { "type": "package", "package": { "name": "queueit/KnownUser.V3.PHP", "version": "dev-master", "source": { "type": "git", "url": "https://github.com/kenorb-contrib/KnownUser.V3.PHP.git", "reference": "task/composer-autoloader" } } } ] } However upon running composer install , the namespaces or classes aren't added into autoload_classmap.php or autoload_namespaces.php in vendor/composer . Before that I've added into project's composer.json these lines: "autoload": { "psr-4

PSR-4 directory structure and namespacing for a set of functions?

烈酒焚心 提交于 2019-12-07 04:05:26
问题 I have a set of PHP functions that I find useful. I want to create a PSR-4 compliant repository for them, but the guides I have found (1,2,3) seem to talk only about classes for autoloading. For instance, my files are as follows, with one function per file: my_cool_function1.php my_cool_function2.php ... etc. How can I create a PSR-4 compliant library from them? 回答1: The reason you're not able to find any documentation for PSR-4 autoloading files which aren't classes, that's because as the

PHP reserved keywords allowed in namespace? (public, private, default)

十年热恋 提交于 2019-12-06 13:50:19
PhpStorm is highlighting the following namespace as an error. <?php namespace App\Http\Controllers\Public; Error: Expected: identifier In general. Are reserved keywords like public , function , class not acceptable for namespacing? The PHP manual hints that as of PHP 7.0.0 these keywords are allowed as property, constant, and method names of classes, interfaces and traits, except that class may not be used as constant name , which also incorporate the requested keyword public . List of reserved keywords, which you can't use for namespacing: __halt_compiler , abstract , and , array , as , break