You can do this is in many ways like:
1- You can use Wordpress global variable $post
:
<?php
global $post;
$post_slug=$post->post_name;
?>
2- Or you can get use:
$slug = get_post_field( 'post_name', get_post() );
3- Or get full url and then use the PHP function parse_url
:
$url = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
$url_path = parse_url( $url, PHP_URL_PATH );
$slug = pathinfo( $url_path, PATHINFO_BASENAME );
I hope above methods will help you.