We knew it was coming. 

It was inevitable that Tampa Bay would be saying goodbye to someone before the 4 p.m. MLB Trade Deadline on Tuesday.

A wild ending it was for the Tampa Bay Rays, as pitcher Chris Archer and catcher Wilson Ramos were dealt away. 

RAYS TRADE CHRIS ARCHER TO PITTSBURGH

The Rays traded top starting pitcher Chris Archer to the Pirates for a pair of coveted prospects, OF Austin Meadows and RHP Tyler Glasnow, plus a third player to be named later.

Archer, a two-time All-Star, is 3-5 with a 4.31 ERA in 17 starts this season for the Rays. He has been the leader of the Rays rotation for the past several years, making four straight opening-day starts.

Archer, who will turn 30 in September, has consistently given back to the Tampa Bay community through his foundation, the Archway Foundation that strives to end teen homelessness and provide youth with the means to reach their hopes and dreams. He also works with Starting Right, Now, a non-profit that addresses teen homelessness in Pinellas County.

Archer leaves Tampa Bay 4th in franchise history in wins (54) and second in strikeouts (1,146).

RAYS TRADE WILSON RAMOS TO PHILADELPHIA

The NL East-leading Philadelphia Phillies have acquired All-Star catcher Wilson Ramos from the Tampa Bay Rays for a player to be named or cash. 

Ramos is batting .297 with 14 homers and 53 RBIs but is on the disabled list with a left hamstring strain. He'll upgrade an offense that has struggled during a four-game losing streak. 

Ramos, who turns 31 next month, has a $10.5 million salary, and the Phillies will be responsible for the remaining $3,443,548. He has 315 plate appearances and can earn $250,000 each for 450, 475 and 500.

He is eligible for free agency after the World Series.

Jorge Alfaro has been Philadelphia's starting catcher with Andrew Knapp also seeing plenty of action. They've combined for 16 errors and 13 passed balls. 

RAYS AQUIRE TOMMY PHAM FROM ST. LOUIS

The St. Louis Cardinals have traded outfielder Tommy Pham to the Tampa Bay Rays for three minor leaguers, outfielder Justin Williams, left-handed pitcher Genesis Cabrera and right-handed pitcher Roel Ramirez.

The Rays also received international cap space in the four-player trade announced Tuesday, baseball's deadline for trades without waivers.

There had already been a flurry of moves this week, including closers Roberto Osuna (to Houston) and Ken Giles  (to Toronto) switching teams, Seattle picking up Adam Warren and Zach Duke, Lance Lynn joining the New York Yankees, Adam Duvall moving to Atlanta and Ian Kinsler added to the Boston Red Sox.

The 30-year-old Pham has been a member of the Cardinals' organization since being drafted in 2006. He was batting .248 this season with 14 home runs and 41 RBIs as St. Louis opened the day seven games out of the NL Central lead during a season in which the team has already fired manager Mike Matheny.

Tune into Spectrum Sports 360 at 10:30 p.m. on Tuesday for reaction to the Tampa Bay Rays moves at the trade deadline.

The Assoicated Press contributed to this article.