Classes contain the logic behind the elemental objects that are used within a Cherrycake application.
- Ready-made classes provided by Cherrycake, providing useful object entities to interact with Cherrycake functionalities like the Action or the RequestParameter, and other generalist classes to use throughout your code like the Item or the Image classes.
Classes are automatically loaded the first time they're used, so you don't have to worry to include them anywhere.
$image = new \Cherrycake\Image;
Likewise, to create an object of a class you've created (an App class), just remember to specify our app's namespace instead of
$product = new \CherrycakeApp\Product;
You can also add
usestatements at the top of your file so you don't need to prefix class names each time you want to use them, like this:
$image = new Image;
The App classes you create must be stores in the
/srcdirectory of your app, and the file name must match the class name, plus the
.phpextension. Unlike modules, classes do not need their own directory under
Note that class file names are case-sensitive.