-
Notifications
You must be signed in to change notification settings - Fork 1
Namespaces
Cygnite PHP Framework edited this page Mar 15, 2014
·
3 revisions
Cygnite Framework has powerful namespace import. You can import your libraries, helpers via namespaces.
Every Class should have namespace in top of the page after your php tag. You can easily avoid your name collision. Your namespace should be MixedCase. Example-
"Cygnite\Pdf" is allowed but "Cygnite\PDF" not be proper.
You should follw below patterns while aliases -
- You can import libraries or class by use Cygnite\Assets; // Your aliases is Assets
- use Cygnite\Helpers\Url; // Your aliase is Url
- use Cygnite\Helpers\Profiler as BenchMark; //Your aliase is BenchMark
Cygnite Framework allows you to import all your classes by namespace aliases. You can autoload all your libraries, helpers, models or any kind of class using apps/configs/autoload.php which is internally register all your directory into Cygnite Application. Since Cygnite framework uses lazy loading concept so you can register multiple directories.