Welcome to Wefugees and Thank you for reaching out to us.
A quite similar question has been asked and answered before, please have a look at the following thread:
Can I get married with a refugee in France?
Also, please check out this website, where all the necessary documents and steps to prepare to get married are outlined: https://www.expatica.com/fr/living/love/french-weddings-a-guide-to-getting-married-in-france-101112/
As I understand that your boyfriend is in France illegally, getting married with his (lack of a) legal status seems impossible. There may be different rules that apply if he was an asylum seeker in France. Marrying you as a European citizen would make it possible for him to live with you (spouse visa/ family reunion).
For further information, I would advise you to reach out to any of these pro bono legal aid services in France: http://www.refugeelegalaidinformation.org/france-pro-bono-directory
I hope this helps. Please reach out to us again if you have any more questions!