Showing posts with label library. Show all posts
Showing posts with label library. Show all posts

Sunday, March 16, 2014

in Wamp PHP Startup: Unable to load dynamic library c:\php\

If you are using Wamp server, and when you try to switch between php versions or trying to swirch between Apache versions and you get an error message saying that Php cannot load the dynamic library that you know it is exist in the extensions folder. and the stupid wamp server  looking for that extension in a place other than the one mentioned in phpForApache.ini file.
The Problem here is that php-win.exe running without depending on apache server, So php will use the php.ini file that reside in php folder not the one that reside in Apache folder .
Because I didn't change this file (the one in php folder) and used to deal with phpForApache.ini because it is the one that will be copied to Apache folder .
To solve this issue just make the two files identical , that means when you make any changes to one of the be assure that you make these vhanges in the other one.

Tuesday, July 23, 2013

Adding new classes or library to laravel 4

The ugly, lazy and awful way: At the end of bootstrap/start.php , add an include('tools.php') and place your function in that new file.



The clean way: Create a library. That way it'll be autoloaded ONLY when you actually use it.
  • Create a library folder inside your app folder
  • Edit start/global.php to add app_path().'/library' to the ClassLoader::addDirectories( array.
  • Edit composer.json to add "app/library" to the autoload array.
  • Run composer dump-autoload
  • Create your library file, create a class in it, and add static functions to it
  • Call your class and static functions from your views.
Credit goes to this guy