Traits are for the copy-paste you were about to do

Two classes that need the same six lines and share no useful ancestor leave three bad options: copy the lines, invent a base class whose only purpose is to hold them, or delegate to a helper and wire it up twice. A trait is the fourth — a block of implementation the compiler pastes into the class, with an abstract declaration standing in for whatever the class has to supply.

trait Sluggable
{
    abstract protected function slugSource();

    public function slug()
    {
        $slug = strtolower($this->slugSource());
        $slug = preg_replace('/[^a-z0-9]+/', '-', $slug);

        return trim($slug, '-');
    }
}

class Article
{
    use Sluggable;

    protected function slugSource()
    {
        return $this->title;
    }
}

The abstract method is what keeps this honest: a class that uses the trait without supplying slugSource() is a fatal error when the class is compiled, not a missing method three screens into a request. What a trait is not is a type — Sluggable cannot be type-hinted, so where callers need to check, the class implements an interface as well and the trait supplies the body. The precedence rule is the other thing to know and it is the reverse of most guesses: a method defined in the class beats the trait, and the trait beats the parent class. Two traits declaring the same method are a fatal error until insteadof chooses one.