how to detect a colision on a game objet 2d

i have two box colliders on my player and my enemy and how do i register a collision between the player and the enemy

Collisions happen automatically, both objects need colliders and at least one object needs a rigidbody. There are callbacks to the collisions that you can use in your scripts: OnCollisionEnter, OnCollisionExit, OnCollision, there are also triggers and 2d and 3d methods.