Invoke Apex Class from Trigger

You can create static or instance methods on your Apex Class. In your trigger you can then have code that calls these classes. This is very similar to the way method calling works in other languages. Here is a simple example.

Apex Class:

public class SampleClass
{
    public void SampleMethod(List<Account> listAccount, Map<Id, Account> mapAccount){
        
    }
}

Apex Trigger:

trigger SampleAccount on Account (before insert) 
{
    for(Account a : trigger.New){
        SampleClass obj = new SampleClass(Trigger.New, Trigger.NewMap);
        obj.SampleMethod();
    }
}