There are plenty of safe alternatives to electronic/"invisible" fencing! Among the most popular reasons we hear that people go ahead with the choice to install electric fencing is "we live in an area where physical fences are not allowed".
***Safe alternative #1 - Install an overhead trolley system in the back yard. It can be anchored between 2 large trees, or if your yard doesn't have trees, anchoring to posts sunken in to the ground works just as well. Your dog can have as much "freedom" as you choose to provide. *NOTE: It is not safe to attach a dog to this by his collar. Attach the cable line behind the dog's shoulders using a back-attach harness.
Safe alternative #2 - check with your association about a dog run. My husband and I do own a home in a neighborhood in which perimeter fencing is not allowed, but a dog run to certain specifications, is. Don't assume that a dog run is not allowed. My husband and I wouldn't have known if we hadn't asked our association! We use the dog run area for potty (makes clean up A LOT easier!) and the trolley system out in the yard when our dog is in the yard.