Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #12 from harikt/some-doc

How to make use of the different modes
  • Loading branch information...
commit 8f7e729b907afbf250cc30a2baf44869c07194d1 2 parents 190f434 + 3bd6fcf
@pmjones pmjones authored
Showing with 31 additions and 0 deletions.
  1. +31 −0 README.md
31 README.md
@@ -105,3 +105,34 @@ $loader->setClasses([
'Vendor\Package\Zim' => '/path/to/Vendor/Package/Zim.php',
]);
```
+
+Modes
+=====
+
+In some cases if you are using Exact class usage and if that file contains
+a check for [class_exists](http://php.net/manual/en/function.class-exists.php)
+like functions without second parameter, you will end up with Exceptions.
+As we follow <https://wiki.php.net/rfc/splclassloader>, we have three modes
+which will be helpful.
+
+ * MODE_SILENT (0) : where no exceptions are thrown under error conditions.
+ * MODE_NORMAL (1) : where an exception is thrown when a class file is not found.
+ * MODE_DEBUG (2) : where an exception is thrown when a class file is not
+ found, or if after loading the file the class is still not declared.
+
+Setting different Modes
+=======================
+
+You can either set the mode as
+
+```php
+<?php
+$loader->setMode(\Aura\Autoload\Loader::MODE_SILENT);
+```
+
+Or by passing the values 0,1, 2.
+
+```php
+<?php
+$loader->setMode(0);
+```
Please sign in to comment.
Something went wrong with that request. Please try again.