Q:

Php, static variables for trait itself only, how?

its possible to have static variables for traits:
Trait Example
{
    public static $var;
}

class X
{
    use Example;
}

class Y
{
    use Example;
}

however, the problem is when more class would want to use this trait, I get a fatal error:
Example and X define the same property ($var) in the composition of Y. This might be incompatible, to improve maintainability consider using accessor methods in traits instead. Class was composed

how to define this static variable just for the trait itself?

A:

Traits can define both static members and static methods. however You can not reassign trait properties.
From PHP manual http://php.net/traits
See Example #12 Conflict Resolution

If a trait defines a property then a class can not define a property with the same name, otherwise an error is issued. It is an E_STRICT if the class definition is compatible (same visibility and initial value) or fatal error otherwise.

The solution would be to override properties in the class
 Trait Example
{
    public static $var;
}

class X
{
    use Example;
    public static $var;
}

class Y
{
    use Example;
    public static $var;
}

