1 KING & SPALDING EXHIBIT 5.1 191 Peachtree Street Atlanta, Georgia 30303-1763 Direct Dial: Telephone: 404/572-4600 Direct Fax: 404/572-4600 Facsimile: 404/572-5100 404/572-5145 May 23, 1996 Medaphis Corporation 2700 Cumberland Parkway Suite 300 Atlanta, Georgia 30339 Re: Form S-4 Registration Statement (the "Registration Statement") relating to shares of Common Stock, par value $.01 per share, of Medaphis Corporation Gentlemen: We have acted as counsel for Medaphis Corporation, a Delaware corporation ("Medaphis"), in connection with the transactions contemplated by that certain Merger Agreement, dated as of May 23, 1996 (the "Merger Agreement"), by and among Medaphis, RAKSub, Inc. ("RAKSub") and Health Data Sciences Corporation ("HDS")(the "Merger"). As such counsel, we have examined and relied upon such records, documents, certificates and other instruments as in our judgment are necessary or appropriate to form the basis for the opinion hereinafter set forth. In all such examinations, we have assumed the genuineness of signatures on original documents and the conformity to such original documents of all copies submitted to us as certified, conformed or photographic copies, and as to certificates of public officials, we have assumed the same to have been properly given and to be accurate. Based upon the foregoing, we are of the opinion that the shares of Common Stock, par value $.01 per share, of Medaphis issuable in connection with the Merger have been duly authorized, and, when issued in accordance with the terms set forth in the Merger Agreement, will be validly issued, fully paid and nonassessable. We consent to the filing of this opinion as an Exhibit to the Registration Statement and to the reference to us under the caption "Legal Matters" in the Proxy Statement/Prospectus that forms a part of the Registration Statement. Very truly yours, /s/ King & Spalding King & Spalding