autoloader

Optimize my performance

前提是你 提交于 2019-12-05 05:55:38
I'm working on a project with Zend Framework 1.11, Doctrine 2, some Symfony 2 componenents and others tools & libraries. I'm trying to optimize performance using Xdebug & Webgrind. I've already found some bottlenecks like parsing Ini config, etc.. and cached that. Now, I just realize that the autoloading is the most costly part of my application: Opl\Autoloader\ApcLoader->loadClass 274 31.36 43.86 Zend_Loader_PluginLoader->load 150 4.80 12.29 Zend_Loader_Autoloader->getClassAutoloaders 278 1.42 1.91 Zend_Controller_Router_Route_Regex->_getMappedValues 291 1.29 1.35 Doctrine\ORM\UnitOfWork-

Is module auto-loading meant to be reliable?

a 夏天 提交于 2019-12-05 05:31:30
Environment I have the following folder structure where I keep powershell modules: C: PsModules ... util util.psm1 (this contains implementation of 'Test-Function') util.test.ps1 ftp ftp.psm1 http.test.ps1 ... There are about 50 folders and modules in c:\PsModules . I have set environment variable PSModulePath to include c:\PsModules . This seems to meet the conditions for "well-formed modules" described in Microsoft's documentation and this answer . Symptoms Sometimes Test-Function is not found automatically when calling it from ISE. In fact, on any given fresh launch of ISE, there are always

Where should autloader go in MVC?

冷暖自知 提交于 2019-12-05 01:25:20
问题 I'm trying to build a simple MVC framework to better understand certain concepts. The first thing that I thought would be important to address is a front controller that handles all of the requests for my applications. Once I started to think about it, I wasn't sure of the best way to load the classes that my application would be using. My current thought process is that my autoloader should be located in the front controller since every request utilizes it. Where do most frameworks typically

Autoloading Javascript

给你一囗甜甜゛ 提交于 2019-12-04 10:22:47
I have a interesting concept I was working on and looking over, through various stack questions on auto loading JavaScript. I dint want to use a third party tool, aside form jquery, so I thought I would role my own. The concept I have is: var scripts = { 'name' : 'path/to/script_dir/' // Load all scripts in this file. } requireScripts(scripts); // Requires all scripts // Call your classes, methods, objects and so on .... The requireScript() function would work something like: function requireScript(hash){ $.each(hash, function(key, value)){ $.ajax({ url: value, dataType: "script", async: false

How to list all autoload paths in Rails 3

帅比萌擦擦* 提交于 2019-12-04 08:34:44
问题 How do you list all of the autoload paths in Rails 3? In Rails console when I do this, it only lists the custom paths added to the config: $ rails c Loading development environment (Rails 3.2.9) 1.9.3p194 :001 > MyRailsApp::Application.config.autoload_paths => [] 回答1: You can access all the autoload paths through ActiveSupport::Dependencies.autoload_paths Invoke it from console or run rails r 'puts ActiveSupport::Dependencies.autoload_paths' from command line. More info here (For Rails 4, but

Fatal error in Autoloader.php on line 34 phpExcel

巧了我就是萌 提交于 2019-12-04 07:18:41
I want to use phpExcel, but when run the script I get this error: Fatal error: Uncaught exception 'PHPExcel_Exception' with message 'Multibyte function overloading in PHP must be disabled for string functions (2).' in D:\Apache\htdocs\phpExcel\Classes\PHPExcel\Autoloader.php:34 Stack trace: #0 D:\Apache\htdocs\phpExcel\Classes\PHPExcel.php(32): require() #1 D:\Apache\htdocs\phpExcel\index.php(19): include('D:\Apache\htdoc...') #2 {main} thrown in D:\Apache\htdocs\phpExcel\Classes\PHPExcel\Autoloader.php on line 34 How can I fix it? Thanks Option 1 : If you have access to your php.ini file, set

doctrine2 autloader with cli must use AnnotationRegistry

倾然丶 夕夏残阳落幕 提交于 2019-12-03 13:33:51
问题 I must use \Doctrine\Common\Annotations\AnnotationRegistry::registerFile to access the annotation registry in entity files. This part is required to use driver chain and using orm:schema-tool:creator. but i cant add each class i needed by adding AnnotationRegistry::registerFile . this problem was see when i want to add Gedmo to my Doctrine 2.2.2. // cli-config.php // if comment this like an error will appear // \Doctrine\Common\Annotations\AnnotationRegistry::registerFile(__DIR__ . '/..

Composer autoloader + slim framework - fatal error: Class 'Slim\\Slim' not found?

ε祈祈猫儿з 提交于 2019-12-02 05:28:34
How can I use composer autoloader to load slim? I have it a go below, composer.json: { "autoload": { "psr-4": { "Vendor\\Namespace\\": "" } } } index.php: require dirname(__FILE__).'/vendor/autoload.php'; use \Slim\Slim; Slim::registerAutoloader(); //Instantiate a Slim application: $app = new Slim(); //Define a HTTP GET route: $app->get('/', function () { echo "Hello!"; }); $app->get('/hello/:name/', function ($name) { echo "Hello, $name"; }); //Run the Slim application: $app->run(); error: Fatal error: Class 'Slim\Slim' not found in C:... Any ideas what have I missed? khartnett If you prefer

How can I require composer autoloader in the laravel?

微笑、不失礼 提交于 2019-12-02 03:46:02
问题 I want to install guzzle https://github.com/guzzle/guzzle I read the reference, but I'm confused this section : From that tutorial, asking for require composer autoloader. So seems needed to add require 'vendor/autoload.php'; Where I add the script? I using laravel 5.6 回答1: You don't have to do anything if you are going to install guzzle in Laravel. The example above is for core php actually. Laravel will automatically do it for you. Just run composer require guzzlehttp/guzzle in your

Composer Gives Error, “Class Not Found”

青春壹個敷衍的年華 提交于 2019-12-02 00:26:42
问题 I'm using Windows 10. After making a folder src in the root directory I created two files in it. Directory Structure (Before running composer install ): │ ├── composer.json ├── run.php │ └── src ├── childclass.php └── parentclass.php Two files in the root directory: composer.json: { "name": "myvendor/mypackage", "description": "nothing", "authors": [ { "name": "Omar Tariq", "email": "XXXXX@gmail.com" } ], "require": {}, "autoload": { "psr-4": { "myns\\": "src/" } } } run.php: <?php require