The main influx of revolutionary ideas came at the start of the 19th century when the Philippines was opened for world trade. In 1809, the first British firms were established in Manila, followed by a royal decree in 1834 which officially opened the city to world trade. The Philippines had been governed from Mexico since 1565, with colonial administrative costs sustained by subsidies from the galleon trade. Increased competition with foreign traders brought the galleon trade to an end in 1815. After it recognised Mexican independence in 1821, Spain was forced to govern the Philippines directly from Madrid and to find new sources of revenue to pay for the colonial administration. At this point, post-French Revolution ideas entered the country through literature, which resulted in the rise of an enlightened principalía class in the society.