How do I use RayCast in a 2D Platformer game?

Hello everyone!

I am currently working on a very very simple 2D platformer exercise, and I can’t detect what is ground. With some researches I thought raycasting would be the best solution, but how can I apply it? Here is exactly what I am looking for:

Is there a simple way to apply that when using BoxCollider and RigidBody (both 2d)? How exactly do I use the Physics2D.raycast? Please help me!!