How to add custom PHP classes for use within application

I'm having a hard time finding any documentation on how to create my own classes for use throughout a Concrete5 site in 5.7. For example, I may want to reference this class in controllers, page type controllers, blocks, single pages, etc. In 5.6 I used to either create a Helper or a Model but since these are gone in 5.7 I'm not sure how to go about doing this. My first guess was to simply create my own directory in the application/ directory but I'm not sure this is correct. I'd like to know the right way to go about doing this. I did see some docs on creating my own packages, but it doesn't seem right to have to create a package to hold all my classes. Any insight would be greatly appreciated!

View Replies:
MrKDilkington replied on at Permalink Reply
Hi stephendmalloy,

I believe you can use custom classes the same way in application/src as you would packages/src.

- application\src\Fruit.php
namespace Application\Src;
class Fruit
    public function getFruit()
        return 'apple';

- in a controller
use Application\Src\Fruit;
$fruit = new Fruit();

- in a view
$fruit = new Application\Src\Fruit();
echo $fruit->getFruit();
stephendmalloy replied on at Permalink Reply
Thanks @MrkDilkington - I'll give this a shot.