Who was the first leader to codify his laws?
We really cannot know the answer to this question, because too
much of history has been lost. Legal codes appeared regularly in
ancient times, with the oldest we have dating to about four
thousand years ago. We have many other legal codes from ancient
times. In fact, we have many from Rome alone.
During the Middle ages, emerging Germanic nations produced an
abundance of legal codes. The link below to an article on Early
Germanic Law lists about a dozen, with the earliest, the Code of
Euric, dating to about 480 AD. This was only about four years after
the most commonly used date for the fall of the West Roman Empire.
An important and enduring legal code of the East Roman Empire, the
Code of Justinian, appeared in the first decades of the Middle
Ages.
There are doubtless many legal codes that have been lost. Quite
possibly there are many more than have survived.
There are links below to articles on legal codes.