Yoga is attributed to Patanjali. His Yoga Sutras (5th century A.D.) is still the final authority on the subject and is more reliable than most of the commentaries.
Yoga, by implication, accepts the pessimistic view of life common to all orthodox forms of Indian thought and teaches by a system of mind and body, training, how to obtain release from the cycle of births and deaths.
The Yoga system of training is intellectual as well as moral. The virtues that the trainee is to cultivate are ten: (1) Non-injury (Ahimsa) (2) truth speaking (satya) (3) abstinence from stealing (Asteya) (4) celibacy (Brahmacharya) (5) disowning of possessions (Aparigraha) (6) purity (Sacha) (7) contentment (santosha) (8) fortitude (Tapasa) (9) study (Svadhyaya) (10) devotion to gods (Isvara- pranidhana).
After a student has trained himself sufficiently long in the practice of these virtues, he enters the training of proper yoga.
This training has two stages: the first comprises of Asana (postures), Pranayama (control of breath) and Pratyahara (withdrawal of senses from their objects); and the second Dharana, Dhyana and Samadhi, different forms of concentration.
Of these, Samadhi is the highest stage of yoga which has two substages called Samprajnata Samadhi and Asamprajnata-Samadhi, the latter being the highest and most desirable state.
In this state the mind is so controlled that the yogi loses all consciousness of the outside world and of self and passes into the realm of mysticism.
In the lower Samadhi, the Yogi is not past the stage of experience and hence is in the stage of ecstasy, all source of distraction having been eradicated and the satva quality shining forth.